1. 安装准备 依赖库安装 (PCRE库、zlib库、ssl)
> cd /sour cecode/soft# 安装PCRE库> tar -zxvf pcre-8.38.tar.gz> cd pcre-8.38> ./configure> make> make install# 安装zlib库> cd /sourcecode/soft> tar -zxvf zlib-1.2.11.tar.gz> cd zlib-1.2.11> ./configure> make> make install# 安装ssl> cd /sourcecode/soft> tar -zxvf openssl-1.0.1t.tar.gz
2. 安装nginx
nginx文件放在 /usr/local/src 文件夹下
> cd /usr/local/src
> tar -zxvf nginx-1.14.0.tar.gz
> cd nginx-1.14.0
# 运行以下指令
./configure --sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=/sourcecode/soft/pcre-8.38 \
--with-zlib=/sourcecode/soft/zlib-1.2.11 \
--with-openssl=/sourcecode/soft/openssl-1.0.1t
# 安装
> make&&make install
3. 启动nginx
> cd /usr/local/nginx
# 启动
> ./nginx -c nginx.conf
# 重新启动
> ./nginx -s reload
/usr/local/nginx/nginx -c ./nginx.conf
如果系统中还有其他nginx,这么启动可能会碰到启动其他nginx,需要指定目录启动
# 指定目录启动
> /usr/local/nginx/nginx -c ./nginx.conf
