How to smoothly upgrade nginx after nginx is compiled and installed

王林
Release: 2023-05-13 20:25:11
forward
1177 people have browsed it

1. Download the new version of nginx

How to smoothly upgrade nginx after nginx is compiled and installed

Download page:

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

2. Get the old version of nginx Configuration

View 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
Copy after login

3. Unzip the new version of nginx source code package

tar -xzvf nginx-1.13.12.tar.gz
cd nginx-1.13.12
Copy after login

4. Configuration before recompiling the new version

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

Copy code The code is 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, replace nginx

make
Copy after login

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

[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]#
Copy after login

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

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

6. Smooth upgrade

make upgrade
Copy after login

7. The upgrade is successful, 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
Copy after login

Be sure to back up the nginx program and website files in advance before upgrading to avoid errors.

The above is the detailed content of How to smoothly upgrade nginx after nginx is compiled and installed. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!