日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

1.Nginx的編譯安裝
#1.安裝Nginx所依賴的庫文件或開發包
yum install gcc redhat-rpm-config libxslt-devel gd-devel perl-ExtUtils-Embed geoip-devel gperftools-devel pcre-devel openssl-devel -y
#2.下載軟件、解壓
useradd nginx
wget http://nginx.org/download/nginx-1.14.2.tar.gz
tar xf nginx-1.14.2.tar.gz
cd nginx-1.14.2/
#3.編譯
./configure --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

make
make install
#4.給Nginx1.14版本添加第三方模塊 nginx_upstream_check_module
 wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/master.zip
unzip master.zip
cd nginx-1.14.2/
#打個補丁
patch -p1 <../nginx_upstream_check_module-master/check_1.14.0+.patch
#編譯安裝
./configure --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --add-module=/root/nginx_upstream_check_module-master --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

make 
make install
2.驗證下該模塊是否可用
vim /etc/nginx/conf.d/upstream_check.conf
-----------/etc/nginx/conf.d/upstream_check.conf-------------
upstream blog.oldxu.com {
    server 172.16.1.7:80;
    server 172.16.1.8:80;
    check interval=5000 rise=2 fall=3 timeout=1000 type=tcp;
    #interval檢測間隔時間,單位為毫秒
    #rsie表示請求2次正常,標記此后端的狀態為up
    #fall表示請求3次失敗,標記此后端的狀態為down
    #type  類型為tcp
    #timeout為超時時間,單位為毫秒
}
upstream webserver {
    server 172.16.1.7:80;
    server 172.16.1.8:80;
    check interval=5000 rise=2 fall=3 timeout=1000 type=tcp;
}
upstream php {
    server 172.16.1.7:80;
    server 172.16.1.8:80;
    check interval=5000 rise=2 fall=3 timeout=1000 type=tcp;
}
server {
    listen 8888;
    location / {
        proxy_pass http://blog.oldxu.com;
    }
    location /upstream_status {
        check_status;     #開啟upstream狀態頁面
    }
}
----------/etc/nginx/conf.d/upstream_check.conf結束-----------
3.nginx平滑升級
#1.安裝Nginx所需依賴包
yum install gcc redhat-rpm-config 
	libxslt-devel gd-devel perl-ExtUtils-Embed 
	geoip-devel gperftools-devel pcre-devel openssl-devel -y
#2.下載并編譯Nginx
wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar xf nginx-1.16.1.tar.gz
cd nginx-1.16.1/
rm -f /etc/nginx/conf.d/upstream_check.conf	#由于該三方模塊不兼容1.16版本,所以拿掉避免升級出錯
./configure --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'

make  	#僅make即可,不需要make install,make后會生成新的二進制文件
#3.將舊的nginx二進制文件進行備份,然后替換成為新的nginx二進制文件
mv /usr/sbin/nginx /usr/sbin/nginx.old
cp objs/nginx /usr/sbin/nginx
#4.向舊的Nginx的Master進程發送USR2信號。( 平滑升級二進制可執行文件 )
[root@nfs nginx-1.16.1]# ps -ef |grep nginx
root      20848      1  0 10:21 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     20863  20848  0 10:22 ?        00:00:00 nginx: worker process
nginx     20864  20848  0 10:22 ?        00:00:00 nginx: worker process
#發送信號
[root@nfs nginx-1.16.1]# kill -USR2 20848
#pid文件會自動添加.oldbin后綴,該文件中記錄的是舊master的pid進程號	
[root@nfs nginx-1.16.1]# cat  /var/run/nginx.pid.oldbin
20848
#新老master共存了
[root@nfs nginx-1.16.1]# ps -ef |grep nginx
root      20848      1  0 10:21 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf	(OLD)
nginx     20863  20848  0 10:22 ?        00:00:00 nginx: worker process
nginx     20864  20848  0 10:22 ?        00:00:00 nginx: worker process
root      24971  20848  0 11:37 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf	(NEW)
nginx     24972  24971  0 11:37 ?        00:00:00 nginx: worker process
nginx     24973  24971  0 11:37 ?        00:00:00 nginx: worker process
#驗證站點是否正常
#5.向舊的master進程發送WINCH信號,舊的worker子進程優雅退出。
[root@nfs nginx-1.16.1]# kill -WINCH 20848
[root@nfs nginx-1.16.1]# ps -ef |grep nginx
root      20848      1  0 10:21 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
root      24971  20848  0 11:37 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     24972  24971  0 11:37 ?        00:00:00 nginx: worker process
nginx     24973  24971  0 11:37 ?        00:00:00 nginx: worker process

#6.向舊的master進程發送QUIT信號,舊的master進程就退出了。
[root@nfs nginx-1.16.1]# kill -QUIT 20848
[root@nfs nginx-1.16.1]# ps -ef |grep nginx
root      24971      1  0 11:37 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     24972  24971  0 11:37 ?        00:00:00 nginx: worker process
nginx     24973  24971  0 11:37 ?        00:00:00 nginx: worker process

 

版權聲明:本文為CSDN博主「Lem0n_Tree」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。

原文鏈接:https://blog.csdn.net/Lem0n_Tree/article/details/106036705

分享到:
標簽:編譯 nginx
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定