Nginx service installation and software upgrade method

09-12-2023

Experimental environment: [root @ nginx ~] # cat/etc/red hat-release centos Linux release 7.4.1708 (core) [root @ nginx ~] # uname-r3.10.0-693.el7.x86 _ 64.

To prepare for the installation of the lower version Nginx server, please refer to:

Xiaobai can also complete the 0-based deployment of Nginx services.

Prepare and compile a new version of Nginx software to view the old version of Nginx:

[root@nginx nginx-1.10.3]# /app/nginx/sbin/nginx -Vnginx version: nginx/1.8.1built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017TLS SNI support enabledconfigure arguments: --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module

Download the new version of Nginx service software:

[root@nginx ~]# wget -q http://nginx.org/download/nginx-1.10.3.tar.gz

After decompression, enter the directory:

[root@nginx tools]# tar xf nginx-1.10.3.tar.gz [root@nginx tools]# cd nginx-1.10.3/

To precompile and compile:

[root@nginx nginx-1.10.3]# ./configure --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module[root@nginx nginx-1.10.3]# make

The new version replaces the old version to back up the old version executable file:

[root@nginx ~]# mv /app/nginx/sbin/nginx /app/nginx/sbin/nginx.old[root@nginx nginx-1.10.3]# cp objs/nginx /app/nginx/sbin/

Check whether the new version is normal:

[root@nginx ~]# /app/nginx/sbin/nginx -tnginx: the configuration file /app/nginx-1.8.1//conf/nginx.conf syntax is oknginx: configuration file /app/nginx-1.8.1//conf/nginx.conf test is successful

Perform a smooth restart and view the version:

[root@nginx ~]# /app/nginx/sbin/nginx -s reload[root@nginx ~]# /app/nginx/sbin/nginx -Vnginx version: nginx/ 1.10.3built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017TLS SNI support enabledconfigure arguments: --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module

Check the process:

[root@nginx ~]# ps -ef | grep nginxroot 9003 1 0 10:24 ? 00:00:00 nginx: master process /app/nginx/sbin/nginxnginx 11720 9003 0 11:24 ? 00:00:00 nginx: worker processroot 11724 1223 0 11:24 pts/0 00:00:00 grep --color=auto nginx

Check port:

[root@nginx ~]# ss -utpln | grep nginxtcp LISTEN 0 128 *:80 *:* users:(("nginx",pid=11720,fd=6),("nginx",pid=9003,fd=6))

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us