[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\\\’

二、將上面加粗字體部分進行配置,加粗字體后面為系統的配置文件不需要配置,只需要到 make,千萬不要 make install 。如果make install 會將原來的配置文件覆蓋

事先可以先把這些依賴包下好,配置之后就不會出現下面這些錯誤了
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
準備新版本的nginx放在/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

有可能的報錯
報錯1:
./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
原因:缺少依賴
解決:
[root@vm-3 nginx-1.16.1]# yum -y install libxml2 libxslt-devel

再次配置
報錯2:
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
解決:安裝依賴
yum -y install gd-devel

再次配置
報錯3:
./configure: error: perl module ExtUtils::Embed is required
解決:
yum -y install perl-devel perl-ExtUtils-Embed
再次配置
報錯4:
./configure: error: the GeoIP module requires the GeoIP library. You can either do not enable the module or install the library.
解決:
yum -y install GeoIP GeoIP-devel GeoIP-data
再次配置
報錯5:
./configure: error: the Google perftools module requires the Google perftools
library. You can either do not enable the module or install the library.
解決:
yum install gperftools**
再次配置成功

三、make千萬不要make install

四、備份原 nginx 二進制文件
備份二進制文件和 nginx 的配置文件(期間nginx不會停止服務)
[root@vm-3 nginx-1.16.1]# mv /usr/sbin/nginx /usr/sbin/nginx_$(date %F)

五、復制新的nginx二進制文件,進入新的nginx源碼包
[root@vm-3 nginx-1.16.1]# cp /root/nginx-1.16.1/objs/nginx /usr/sbin/

六、測試新版本的nginx是否正常
[root@vm-3 nginx-1.16.1]# nginx -t
報錯:
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
解決:
vim /etc/nginx/nginx.conf //進入配置文件中
注釋 #include /usr/share/nginx/modules/*.conf;
再次檢測成功

七、給nginx發送平滑遷移信號(若不清楚pid路徑,請查看nginx配置文件或find / -name \\\’nginx.pid\\\’ 查找)
[root@vm-3 nginx-1.16.1]# kill -USR2 cat /run/nginx.pid

八、查看nginx pid,會出現一個nginx.pid.oldbin
[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

九、從容關閉舊的Nginx進程
[root@vm-3 nginx-1.16.1]# kill -WINCH cat /run/nginx.pid.oldbin

十、此時不重載配置啟動舊的工作進程
[root@vm-3 nginx-1.16.1]# kill -HUP cat /run/nginx.pid.oldbin

十一、結束工作進程,完成此次升級
[root@vm-3 nginx-1.16.1]# kill -QUIT cat /run/nginx.pid.oldbin

十二、驗證Nginx是否升級成功
[root@vm-3 nginx-1.16.1]# nginx -v
nginx version: nginx/1.16.1
升級成功

更多關于云服務器域名注冊,虛擬主機的問題,請訪問三五互聯官網:m.shinetop.cn

贊(0)
聲明:本網站發布的內容(圖片、視頻和文字)以原創、轉載和分享網絡內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。郵箱:3140448839@qq.com。本站原創內容未經允許不得轉載,或轉載時需注明出處:三五互聯知識庫 » linux centos7 實現yum安裝的nginx平滑升級 從1.12.2版本到1.16.1版本

登錄

找回密碼

注冊

主站蜘蛛池模板: 乱码精品一区二区亚洲区| 一道本AV免费不卡播放| 三上悠亚在线精品二区| 亚洲国产精品毛片av不卡在线| 国产精品极品美女自在线观看免费| 男女啪啪高潮激烈免费版| 亚洲av在线观看| 国产又爽又黄又无遮挡的激情视频| 在线免费观看毛片av| 青草99在线免费观看| 欧美成人免费全部| 久久精品国产亚洲av成人| 国精产品一区一区三区有限公司杨 | 国产99在线 | 欧美| 安乡县| 国内精品久久久久影院网站| 久久婷婷五月综合色欧美| 深夜av在线免费观看| 桃花岛亚洲成在人线AV| 国产高跟黑色丝袜在线| 动漫AV纯肉无码AV电影网| 久久精品夜色噜噜亚洲aa| 亚洲经典在线中文字幕| 国产农村激情免费专区| 九九热热久久这里只有精品| 中文字幕不卡在线播放| 梁山县| 精品国产成人亚洲午夜福利| 亚洲日本精品一区二区| 亚洲第一香蕉视频啪啪爽| 野外做受三级视频| 色婷婷久久综合中文久久一本 | 久久精品国产久精国产果冻传媒| 乱女乱妇熟女熟妇综合网| 天堂8中文在线最新版在线| 国产精品视频第一第二区| 无码人妻斩一区二区三区| 久热这里只有精品6| 国产一二三四区中| 夜夜爽妓女8888888视频| 国产91成人亚洲综合在线|