Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux centos7 implements smooth nginx upgrade for yum installation from 1.12.2 to 1.16.1

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Yum install nginx-1.12.2 upgrade to nginx-1.16.1

1. Check the existing nginx compilation parameters

[root@vm-3] # nginx-V

Nginx version: nginx/1.12.2

Built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)

Built with OpenSSL 1.0.2k-fips 26 Jan 2017

TLS SNI support enabled

Configure arguments:-prefix=/usr/share/nginx-- sbin-path=/usr/sbin/nginx-- modules-path=/usr/lib64/nginx/modules-- conf-path=/etc/nginx/nginx.conf-- error-log-path=/var/log/nginx/error.log-- http-log-path=/var/log/nginx/access.log-- http-client-body-temp-path=/var/lib/nginx/tmp/clientbody-- http-proxy-temp-path=/var/lib/nginx / tmp/proxy-http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi-http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi-http-scgi-temp-path=/var/lib/nginx/tmp/scgi-pid-path=/run/nginx.pid-lock-path=/run/lock/subsys/nginx-user=nginx-group=nginx-with-file-aio-with-ipv6-with-httpauthrequestmodule-with-httpsslmodule-with-httpv2module With-httprealipmodule-with-httpadditionmodule-with-httpxsltmodule=dynamic-with-httpimagefiltermodule=dynamic-with-httpgeoipmodule=dynamic-with-httpsubmodule-with-httpdavmodule-with-httpflvmodule-with-httpmp4module-with-httpgunzipmodule-with-httpgzipstaticmodule-with-httprandomindexmodule-with-httpsecurelinkmodule-with-httpdegradationmodule-with-httpslicemodule-with-httpstubstatusmodule-with-httpperlmodule=dynamic-with-mail=dynamic-with-mailsslmodule-with-pcre--with-pcre-jit-with-stream=dynamic-with-streamsslmodule-with-googleperftoolsmodule -with-debug-- with-cc-opt='-O2-g-pipe-Wall-Wp -D_FORTIFY_SOURCE=2-fexceptions-fstack-protector-strong-- param=ssp-buffer-size=4-grecord-gcc-switches-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1-M64-mtune=generic'-with-ld-opt='-Wl,-z,relro-specs=/usr/lib/rpm/redhat/redhat-hardened-ld-Wl,-E'

Second, the above part of the bold font for configuration, after the bold font for the system configuration file does not need to configure, only need to make, do not make install. If make install overwrites the original configuration file

You can package these dependencies in advance, so that the following errors will not occur after configuration.

Yum-y install gcc make GeoIP GeoIP-devel GeoIP-data perl-devel perl-ExtUtils-Embed gd-devel libxml2 libxslt-devel gperftools pcre-devel openssl openssl-devel

Prepare a new version of nginx and put it under / usrr/local/

[root@vm-3] # wget http://nginx.org/download/nginx-1.16.1.tar.gz

[root@vm-3] # tar-xf nginx-1.16.1.tar.gz

[root@vm-3] # cd nginx-1.16.1

[root@vm-3 nginx-1.16.1] # / configure-- prefix=/usr/share/nginx-- sbin-path=/usr/sbin/nginx-- modules-path=/usr/lib64/nginx/modules-- conf-path=/etc/nginx/nginx.conf-- error-log-path=/var/log/nginx/error.log-- http-log-path=/var/log/nginx/access.log-- http-client-body-temp-path=/var/lib/nginx/tmp/client _ body-http-proxy-temp-path=/var/lib/nginx/tmp/proxy-- http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi-- http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi-- http-scgi-temp-path=/var/lib/nginx/tmp/scgi-- pid-path=/run/nginx.pid-- lock-path=/run/lock/subsys/nginx-- user=nginx-- group=nginx-- with-file-aio-- with-ipv6 -- with-http_auth_request_module-- with-http_ssl_module-- with-http_v2_module-- with-http_realip_module-- with-http_addition_module-- with-http_xslt_module=dynamic-- with-http_image_filter_module=dynamic-- with-http_geoip_module=dynamic-- with-http_sub_module-- with-http_dav_module-- with-http_flv_module-- with-http_mp4_module-- with-http_gunzip_ Module-with-http_gzip_static_module-with-http_random_index_module-with-http_secure_link_module-with-http_degradation_module-with-http_slice_module-with-http_stub_status_module-with-http_perl_module=dynamic-with-mail=dynamic-with-mail_ssl_module-with-pcre- with-pcre-jit-with-stream=dynamic with-stream_ssl_module with-google_perftools_module with-debug

A possible error report

Error 1:

. / configure: error: the HTTP XSLT module requires the libxml2/libxslt

Libraries. You can either do not enable the module or install the libraries.

Reason: lack of dependency

Resolve:

[root@vm-3 nginx-1.16.1] # yum-y install libxml2 libxslt-devel

Configure again

Error 2:

. / configure: error: the HTTP image filter module requires the GD library.

You can either do not enable the module or install the libraries.

Resolution: installation dependency

Yum-y install gd-devel

Configure again

Error 3:

. / configure: error: perl module ExtUtils::Embed is required

Resolve:

Yum-y install perl-devel perl-ExtUtils-Embed

Configure again

Error 4:

. / configure: error: the GeoIP module requires the GeoIP library. You can either do not enable the module or install the library.

Resolve:

Yum-y install GeoIP GeoIP-devel GeoIP-data

Configure again

Error 5:

. / configure: error: the Google perftools module requires the Google perftools

Library. You can either do not enable the module or install the library.

Resolve:

Yum install gperftools**

Configuration succeeded again

Never make a make install

Back up the original nginx binaries

Backup binaries and configuration files for nginx (nginx will not stop service during that time)

[root@vm-3 nginx-1.16.1] # mv / usr/sbin/nginx / usr/sbin/nginx_$ (date +% F)

Copy the new nginx binary file and enter the new nginx source code package

[root@vm-3 nginx-1.16.1] # cp / root/nginx-1.16.1/objs/nginx / usr/sbin/

6. Test whether the new version of nginx is normal.

[root@vm-3 nginx-1.16.1] # nginx- t

Error report:

Nginx: [emerg] module "/ usr/lib64/nginx/modules/ngx_http_geoip_module.so" version 1012002 instead of 1016001 in / usr/share/nginx/modules/mod-http-geoip.conf:1

Nginx: configuration file / etc/nginx/nginx.conf test failed

Resolve:

Vim / etc/nginx/nginx.conf / / enter the configuration file

Note # include / usr/share/nginx/modules/*.conf

Successful detection again

7. Send a smooth migration signal to nginx (if you don't know the pid path, please check the nginx configuration file or find /-name 'nginx.pid' search)

[root@vm-3 nginx-1.16.1] # kill-USR2 cat / run/nginx.pid

8. Check nginx pid and a nginx.pid.oldbin will appear

[root@vm-3 nginx-1.16.1] # ll / run/nginx*

-rw-r--r-- 1 root root 5 Sep 6 00:36 / run/nginx.pid

-rw-r--r-- 1 root root 6 Sep 6 00:00 / run/nginx.pid.oldbin

IX. Calmly shut down the old Nginx process

[root@vm-3 nginx-1.16.1] # kill-WINCH cat / run/nginx.pid.oldbin

Do not reload the configuration to start the old worker process at this time

[root@vm-3 nginx-1.16.1] # kill-HUP cat / run/nginx.pid.oldbin

Finish the work process and complete the upgrade

[root@vm-3 nginx-1.16.1] # kill-QUIT cat / run/nginx.pid.oldbin

Verify whether the Nginx upgrade is successful

[root@vm-3 nginx-1.16.1] # nginx- v

Nginx version: nginx/1.16.1

Upgrade succeeded

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report