1,查看Nginx当前版本。
复制代码代码示例:
# /usr/local/webserver/nginx/sbin/nginx -V
nginx: nginx version: nginx/1.0.5 nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-50) nginx: TLS SNI support disabled nginx: configure arguments: --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-cc-opt=-O3 --with-cpu-opt=opteron --with-http_gzip_static_module
※ 注意红色区域,这是以前编译的参数。 2,下载新版本:http://nginx.org/en/download.html
然后:解压 > 便以前的准备 > 编译
复制代码代码示例:
# tar zxvf nginx-1.0.5.tar.gz
# cd nginx-1.0.5 # ./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-cc-opt='-O3' --with-cpu-opt=opteron --with-http_gzip_static_module # make
3,执行完后,重名/sbin/nginx为nginx.old
复制代码代码示例:
# mv /usr/local/webserver/nginx/sbin/nginx /usr/local/webserver/nginx/sbin/nginx.old
4,复制编译后objs目录下的nginx文件到nginx的安装目录sbin/下
复制代码代码示例:
# cp objs/nginx /usr/local/webserver/nginx/sbin/
5,测试新复制过来文件生效情况:
复制代码代码示例:
# /usr/local/webserver/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful
6,让nginx把nginx.pid文件修改成nginx.pid.oldbin,启动nginx,实现不间断
复制代码代码示例:
# kill -USR2 `cat /usr/local/webserver/nginx/nginx.pid`
# kill -QUIT `cat /usr/local/webserver/nginx/nginx.pid.oldbin`
6 或者
7,查看升级后的nginx版本
复制代码代码示例:
# /usr/local/webserver/nginx/sbin/nginx -v nginx: nginx version: nginx/1.0.5
(责任编辑:IT) |