本篇文章主要介绍编译无缝平滑升级Nginx 1.6.0至Nginx 1.6.1。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
##下载最新软件 [root@idoseek ~]# cd /usr/local/src/ && wget http://nginx.org/download/nginx-1.6.1.tar.gz && tar -zxvf nginx-1.6.1.tar.gz ##解压并根据原参数编译 [root@idoseek nginx-1.6.1]# cd nginx-1.6.1 && ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35 && make ##备份nginx应用程序 [root@idoseek nginx-1.6.1]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak ##拷贝编译生成的nginx可执行应用程序至nginx根目录 [root@iifocus nginx-1.6.1]# cp objs/nginx /usr/local/nginx/sbin/nginx ##测试nginx配置是否正确 [root@idoseek nginx-1.6.1]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful ##平滑升级nginx [root@idoseek nginx-1.6.1]# make upgrade /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` sleep 1 test -f /usr/local/nginx/logs/nginx.pid.oldbin kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` ##查看nginx升级后的版本 [root@idoseek nginx-1.6.1]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.6.1 built by gcc 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35 |