Table of contents
1) First download a new version of Nginx from the official website
2) First unpack the downloaded compressed package
3) Enter the unpacked directory
4) Configure the installation path
6) Back up the original Nginx resources
foreword
Compared with Apache, Nginx has more loopholes. Generally, you can eliminate bugs by upgrading Nginx. So what is written below is the process of upgrading Nginx.
1. Upgrade Nginx
1) First download a new version of Nginx from the official website
Here you can download your installation package https://nginx.org/download/nginx-1.18.0.tar.gz
wget https://nginx.org/download/nginx-1.18.0.tar.gz
The following is the version nginx-1.12.2.tar.gz that I see
Choose a version that is higher than the original version. nginx-1.22.0 version
2) First unpack the downloaded compressed package
3) Enter the unpacked directory
4) Configure the installation path
cd nginx-1.xx.xx
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module \
--with-http_ssl_module
5)make
Install nginx according to the original compilation parameters, only need to make, do not make install . If make install will overwrite the original configuration file.
make
6) Back up the original Nginx resources
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx_old 备份
cp objs/nginx /usr/local/nginx/sbin/nginx
7) Restart the Nginx service
8) View version
Summarize
To update the software, you only need to compile and install a new version without uninstalling the original software, which can optimize performance, fix bugs, and improve the function and stability of the software.