安装依赖:yum -y install zlib zlib-devel openssl* pcre pcre-devel gd-devel
下载源码解压:wget http://nginx.org/download/nginx-1.12.2.tar.gz ;tar -zxvf nginx-1.12.2.tar.gz
进入解压后目录 进行编译 安装
./configure --prefix="/data1/server/nginx" \
--with-pcre \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-mail \
--with-mail_ssl_module \
--conf-path=/data1/server/nginx/conf/nginx.conf \
--error-log-path=/data1/server/nginx/logs/error.log \
--http-log-path=/data1/server/nginx/logs/access.log
make && make install
启动、停止nginx
cd /data1/server/nginx/sbin/
./nginx 启动
./nginx -s stop 此方式停止步骤是待nginx进程处理任务完毕进行停止
./nginx -s quit 此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程
./nginx -s reload 重新读取配置
参考 https://www.cnblogs.com/KenChung/p/8079313.html