nginx服务1.2.7到1.4.7的无缝升级

查看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

wKiom1NGYmvzg6vEAAFJepg47SY133.jpg


第一次升级的时候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,如需转载请自行联系原作者
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值