查看nginx版本
1
2
3
4
5
|
# nginx -V
nginx version: nginx/
1.2
.
7
built by gcc
4.4
.
7
20120313
(Red Hat
4.4
.
7
-
4
) (GCC)
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --
with
-http_stub_status_module --
with
-http_ssl_module --
with
-http_gzip_static_module --
with
-ipv6
|
下载并安装nginx nginx-1.4.7 稳定版
1
|
wget http:
//nginx.org/download/nginx-1.4.7.tar.gz
|
编译nginx的时候,后面的参数请和上面nginx -V 显示的参数保持一致
1
2
3
4
|
tar -xzf nginx-
1.4
.
7
.tar.gz
cd nginx-
1.4
.
7
./configure --prefix=/usr/local/nginx/ --user=www --group=www --prefix=/usr/local/nginx --
with
-http_stub_status_module --
with
-http_ssl_module --
with
-http_gzip_static_module --
with
-ipv6 #配置的就按以前的配置文件来,nginx -V 后面显示的
make
|
更新nginx版本
1
2
3
4
5
6
7
8
9
10
|
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
cp objs/nginx /usr/local/nginx/sbin/
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版本
1
2
|
/usr/local/nginx/sbin/nginx -v
ps aux|grep nginx |wc
|
第一次升级的时候make upgrade 后提示有错误,
1
2
3
4
5
6
7
|
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 make: *** [upgrade] Error
1
|
找到旧版本的nginx的进程号,kill掉,检查nginx的版本已经升级,
本文转自 bbotte 51CTO博客,原文链接:http://blog.51cto.com/bbotte/1385188,如需转载请自行联系原作者