Nginx1.18.0 smooth upgrade steps

Upload the file to the /urs/local directory.

nginx-1.18.0.tar.gz

Download link: http://nginx.org/en/download.html

Execute tar zxvf nginx-1.18.0.tar.gz to decompress.

cd /usr/local/nginx-1.18.0
1、查看当前Nginx版本
    [root@test-25 nginx-1.18.0]# /usr/local/nginx/sbin/nginx  -V
    nginx version: nginx/0.7.9
    built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
    configure arguments: --prefix=/usr/local/nginx

2. Configure nginx and compile, remember not to make install
     [root@test-25 nginx-1.18.0]#./configure --prefix=/usr/local/nginx
     [root@test-25 nginx-1.18.0]# make


3. Back up the original nginx file and use the latest file


    First     look at the file date: [root@test-25 nginx-1.18.0]# ll /usr/local/nginx/sbin/nginx
    -rwxr-xr-x 1 root root 2337456 Aug 12 2015 /usr/local/nginx/ sbin/nginx

     [root@test-25 nginx-1.18.0]#mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

4. Use the latest file
    [root@test-25 nginx-1.18.0]#cp /usr/local/nginx-1.18.0/objs/nginx /usr/local/nginx/sbin/nginx and
    look at the file date:
    [root@test-25 nginx-1.18.0]# ll /usr/local/nginx/sbin/nginx
    -rwxr-xr-x 1 root root 3784415 Sep 2 16:31 /usr/local/nginx/sbin/nginx

5、升级nginx(提示正常)
    [root@test-25 nginx-1.18.0]# 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`


6. Check the version information after the upgrade (the upgrade is successful and the service is not interrupted)

   [root@test-25 local]#  /usr/local/nginx/sbin/nginx  -V
   nginx version: nginx/1.18.0
   built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
   configure arguments: --prefix=/usr/local/nginx

Guess you like

Origin blog.csdn.net/lc547913923/article/details/108864472