Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx hot deployment upgrad

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. Hot upgrade process

1. Replace the old nginx file with the new nginx binary file (pay attention to backup)

2. Send USR2 signal to master process

3. The master process modifies the pid file name with the suffix. oldbin

4. The master process starts the new master process after using the new nginx file

5. Send WINCH signal to the old master process to shut down the old worker process.

6. Rollback: send HUP signal to the old master and QUIT to the new master

II. Upgrade process

# version

Nginx version: nginx/1.12.2

1. View nginx status

2. To upgrade the nginx version is to upgrade the binaries

Path: / nginx/sbin/nginx

1) back up the original files and replace the new nginx binaries

# cp sbin/nginx sbin/nginx.old

2) after compiling the new version to make, copy the binary nginx file (remember to compile to the same directory)

# cd nginx-1.14.2/

#. / configure-prefix=/usr/local/nginx12

3make

# cp-r objs/nginx / usr/local/nginx12/sbin/-f

3) View binaries

Cd / usr/local/nginx/sbin/

4) send an upgrade signal to the process number

# kill-USR2 1501 # master thread

5) gracefully close the old thread

# kill-WINCH 1501

Note: keep the old master thread, which can be used for rollback. If you confirm that you don't need it, you can kill it.

4) View version

Note: if we have a problem after the upgrade, we can take the next step to roll back.

3. Rollback operation

1) back up files again

# cp-f / usr/local/nginx12/sbin/nginx.old / usr/local/nginx12/sbin/nginx

2) perform smoothing to generate a new process

# kill-HUP 4197

# kill-QUIT 4197

The master process is rolled back to 1501 and the worker process is also regenerated. Check the website and complete the rollback operation here.

3) View version

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report