下載Nginx地址:http://nginx.org/download/nginx-1.12.1.tar.gz
nginx版本:1.8.0
nginx升級版本:1.12.1
nginx -v #查看當前Nginx版本
nginx -V #查看當前Nginx編譯參數
在執行編譯時會報錯沒有--with-http_spdy_module選項(nginx 1.9.5 已經沒有了 --with-http_spdy_module ,取代的是 --with-http_v2_module),查看官方模塊地址:http://nginx.org/en/docs/
開始部署linux
[root@localhost src]#tar xvf nginx-1.12.1.tar.gz [root@localhost nginx-1.12.1]# cd nginx-1.12.1 [root@localhost nginx-1.12.1]# ./configure --user=tdoa --group=tdoa --prefix=/usr/local/tdoa/nginx --with-file-aio --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=/root/linux-2015/down/pcre-8.32 --with-pcre-jit --with-http_v2_module [root@localhost nginx-1.12.1]# make
執行make後,make install無需執行,將現有nginx重命名nginx
[root@localhost objs]# mv /usr/local/tdoa/nginx/sbin/nginx /usr/local/tdoa/nginx/sbin/nginx.old [root@localhost objs]# pwd /usr/local/src/nginx-1.12.1/objs [root@localhost objs]# cp nginx nginx nginx.8 [root@localhost objs]# cp nginx /usr/local/tdoa/nginx/sbin/ [root@localhost objs]# /usr/local/tdoa/nginx/sbin/nginx -v nginx version: nginx/1.12.1 [root@localhost objs]# /usr/local/tdoa/nginx/sbin/nginx -t nginx: the configuration file /usr/local/tdoa/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/tdoa/nginx/conf/nginx.conf test is successful [root@localhost objs]# /usr/local/tdoa/nginx/sbin/nginx -s reload [root@localhost objs]# netstat -tnlp |grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 98457/nginx tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1680/cupsd tcp 0 0 ::1:631 :::* LISTEN 1680/cupsd