如何升级nginx最新版?如何不停网站升级nginx?Nginx编译后就一个小文件,不带动态库,升级也可以无缝升级,并不影响访问,
平滑/无缝/网站不中断访问/不停止nginx升级nginx的方法:
[[email protected]]# /usr/local/nginx/sbin/nginx -V #查看版本
nginx version: nginx/0.8.6
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
configure arguments: –user=www –group=www –prefix=/opt/nginx –with-http_stub_status_module –with-http_ssl_module #注意这里的编译项
wget http://www.ctohome.com/linux-vps-pack/soft/nginx/nginx_cache_purge.tar.gz;
tar -zxvf nginx_cache_purge.tar.gz;
wget http://nginx.org/download/nginx-0.9.3.tar.gz;
tar -zxvf nginx-*.tar.gz;
cd nginx-*;
./configure --user=apache --group=apache --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_flv_module --add-module=/backup/www.ctohome.com/ngx_cache_purge-1.1;
make; (注意,不要make install)
[[email protected]]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old #移动旧版本
[[email protected]]# cp ./objs/nginx /usr/local/nginx/sbin/ #复制新版本nginx过去
[[email protected]]# make upgrade #无缝升级,当前连接不会断
[[email protected]]# cd ..
[[email protected]]# /usr/local/nginx/sbin/nginx -V
nginx: nginx version: nginx/0.9.3
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
nginx: configure argument
搞定,收工。不放心的就重启下nginx测试下网站是否正常吧