1、下载&安装
nginx模块依赖以下库:gzip模块需要zlib库、rewrite模块需要pcre库、ssl功能需要openssl库
pcre
wget http://netassist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.bz2
tar -jxvf pcre-8.38.tar.bz2
cd pcre-8.38
ls -al
ls *confi*
./configure
make
make install
zlib
wget http://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
ls -al
ls *confi*
./configure
make
make install
openssl
wget http://www.openssl.org/source/openssl-1.0.1s.tar.gz
tar -zxvf openssl-1.0.1s.tar.gz
cd openssl-1.0.1s
ls -al
ls *confi*
./config
make
make install
nginx
wget http://nginx.org/download/nginx-1.8.1.tar.gz
tar -zxvf nginx-1.8.1.tar.gz
./configure --with-openssl=/home/lingy/download/openssl-1.0.1s --with-pcre=/home/lingy/download/pcre-8.38 --with-zlib=/home/lingy/download/zlib-1.2.8
make
make install
2、运行
目录结构:ls -al /usr/local/nginx
client_body_temp
conf
fastcgi_temp
html
logs
proxy_temp
sbin
scgi_temp
uwsgi_temp
配置文件
fastcgi.conf
fastcgi.conf.default
fastcgi_params
fastcgi_params.default
koi-utf
koi-win
mime.types
mime.types.default
nginx.conf[1]
nginx.conf.default
scgi_params
scgi_params.default
uwsgi_params
uwsgi_params.default
win-utf
运行
cd /usr/local/nginx/sbin/
./nginx -t
./nginx
重启
./nginx -s reload
访问
在地址栏上敲:http://localhost:8099
注:需要在nginx.config中将80端口(默认80)改成8099端口
-
主要配置文件 ↩