Nginx service installation and software upgrade methods

WBOY
Release: 2023-05-23 16:55:06
forward
1322 people have browsed it

Experimental environment:

[root@nginx ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@nginx ~]# uname -r 3.10.0-693.el7.x86_64
Copy after login

Prepare low version Nginx server

Please refer to the installation of low version environment:

0 basic deployment Nginx service that novices can also complete

Prepare and compile the new version of Nginx software

View the old version of Nginx:

[root@nginx nginx-1.10.3]# /app/nginx/sbin/nginx -V nginx version: nginx/1.8.1 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: --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module
Copy after login

Download the new version of Nginx service software:

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

Unzip and enter the directory:

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

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

Replace the old version with the new version

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

Check whether the new version is normal:

[root@nginx ~]# /app/nginx/sbin/nginx -t nginx: the configuration file /app/nginx-1.8.1//conf/nginx.conf syntax is ok nginx: configuration file /app/nginx-1.8.1//conf/nginx.conf test is successful
Copy after login

Perform a graceful restart and check the version:

[root@nginx ~]# /app/nginx/sbin/nginx -s reload [root@nginx ~]# /app/nginx/sbin/nginx -V nginx version: nginx/1.10.3 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: --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module
Copy after login

Check the process:

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

Check the port:

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

The above is the detailed content of Nginx service installation and software upgrade methods. 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
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!