• Nginx 无缝升级


    转自:http://www.cnblogs.com/nkuhero/archive/2011/08/30/2159182.html

    今天闲来研究了一下nginx的无缝升级,还真是简单啊,之前看了些文章写的是1.1之前版本的无缝升级,说是make以后,不要make install,要手动将老的nginx文件进行备份,我试了一下1.1.0升级到1.1.1,完全不需要这个操作。

    假如我现在系统是1.1.0,要升级到1.1.1,或者是以前编译的时候有些选项没有加,现在需要重新编译。

    那么我需要做的是在configure的时候,路径选择之前安装版本的路径,然后make && make install

    然后我们进入nginx的sbin目录,我们发现,里面有2个nginx启动文件,nginx和nginx.old

    我们分别用./nginx -v和./nginx.old -v检查一下的话,发现结果老的nginx已经被替换为nginx.old

    ./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`

    ps aux| grep nginx检查一下

    我们发现

    root      2248  0.0  0.1  20752  1420 ?        S    16:46   0:00 nginx: master process ./nginx
    nobody    2249  0.0  0.1  21164  1416 ?        S    16:46   0:00 nginx: worker process
    root      5108  0.0  0.1  20748  1408 ?        S    17:07   0:00 nginx: master process ./nginx
    nobody    5109  0.0  0.1  21144  1172 ?        S    17:07   0:00 nginx: worker process

    而原来存放nginx.pid的目录也自动出现了nginx.pid.oldbin

    现在新的和旧的一起在提供服务,这是我们只需要把旧的停掉就可以了,执行

    kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

    这样升级就完成了,虽然写了这么多话,但其实需要操作的还是很少的。

  • 相关阅读:
    【BZOJ 2324】 [ZJOI2011]营救皮卡丘
    【BZOJ 2809】 [Apio2012]dispatching
    网络流小结
    复活
    终结
    11.7模拟赛
    codevs 2173 忠诚
    P3386 【模板】二分图匹配
    Leetcode 大部分是medium难度不怎么按顺序题解(上)
    ATP的新博客!
  • 原文地址:https://www.cnblogs.com/super119/p/2160356.html
Copyright © 2020-2023  润新知