How to smoothly upgrade nginx after compiling and installing nginx

How to smoothly upgrade nginx after compiling and installing nginx

After nginx is compiled and installed and used for a period of time, if you find that the current version has vulnerabilities or needs new functions, you need to upgrade the current nginx version, but it should not affect normal use. Therefore, you need to smoothly upgrade nginx and update it to the latest version.

This article demonstrates the process of upgrading nginx-1.13.6 to nginx-1.13.12, which is also applicable to other versions.

1. Download the new version of nginx

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

wget -c http://nginx.org/download/nginx-1.13.12.tar.gz

2. Get the configuration of the old version of nginx

Check the current version: /usr/local/nginx/sbin/nginx -v

View the current configuration: /usr/local/nginx/sbin/nginx -V

[root@zixuephp nginx-1.13.6]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.13.6
[root@zixuephp nginx-1.13.6]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.13.6
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-pcre --with-http_ssl_module

3. Unzip the new version of nginx source package

tar -xzvf nginx-1.13.12.tar.gz
cd nginx-1.13.12

4. Configuration before recompiling the new version

The configuration here is the same as the old version: /usr/local/nginx/sbin/nginx -V

Copy the code as follows:
./configure --prefix=/usr/local/nginx --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-pcre --with-http_ssl_module

5. Compile and generate the objs directory, enter the directory, and replace nginx

make

After compiling, you can see that there is an objs directory through ls

[root@zixuephp nginx-1.13.12]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
[root@zixuephp nginx-1.13.12]#

Enter the objs directory and replace the old version of the nginx main program (be sure to back up before operating here to avoid mistakes)

[root@zixuephp objs]#mv nginx /usr/local/nginx/sbin/nginx

6. Smooth upgrade

make upgrade

7. Upgrade successfully, check the version

[root@zixuephp nginx-1.13.12]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.13.12
[root@zixuephp nginx-1.13.12]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.13.12
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-pcre --with-http_ssl_module

Before upgrading, be sure to back up the nginx program, website and other files in advance to avoid errors.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of the process of smooth upgrade of nginx
  • Nginx 1.8.0 version smoothly upgraded to the new version 1.9.7
  • Detailed operation method of Nginx smooth upgrade

<<:  Solution to the problem "Table mysql.plugin doesn't exist" when deploying MySQL

>>:  How to elegantly implement the mobile login and registration module in vue3

Recommend

CSS3 to achieve dynamic background gradient effect

Learning CSS3 is more about getting familiar with...

svg+css or js to create tick animation effect

Previously, my boss asked me to make a program th...

A brief introduction to web2.0 products and functions

<br />What is web2.0? Web2.0 includes those ...

Solving problems encountered when importing and exporting Mysql

background Since I converted all my tasks to Dock...

The connection between JavaScript constructors and prototypes

Table of contents 1. Constructors and prototypes ...

Using HTML web page examples to explain the meaning of the head area code

Use examples to familiarize yourself with the mean...

win2008 server security settings deployment document (recommended)

I had been working on the project before the New ...

About the problem of writing plugins for mounting DOM in vue3

Compared with vue2, vue3 has an additional concep...

Solution to BT Baota Panel php7.3 and php7.4 not supporting ZipArchive

The solution to the problem that the PHP7.3 versi...

Mysql join table and id auto-increment example analysis

How to write join If you use left join, is the ta...

Analysis of idea compiler vue indentation error problem scenario

Project scenario: When running the Vue project, t...

How to implement a single file component in JS

Table of contents Overview Single file components...

A brief discussion on JavaScript scope

Table of contents 1. Scope 1. Global scope 2. Loc...

JavaScript canvas realizes the effect of nine-square grid cutting

This article shares the specific code of canvas t...