Ngx-dyups是什麼,能幹什麼nginx
它是一個Nginx第三方動態Upstream配置模塊,能夠實如今不重啓Nginx狀況下動態更新反向代理Upstream表。該模塊由淘寶開發團隊維護,淘寶自家的Tengine中雖然沒有直接集成該模塊,但能夠經過從新編譯方式加進去。git
源碼地址github
https://github.com/yzprofile/ngx_http_dyups_moduleredis
Ngx-dyups安裝 json
一、下載第三方模塊session
git clone git://github.com/yzprofile/ngx_http_dyups_module.gitxss
二、將第三方模塊目錄複製到最初Openresty下載解壓縮目錄下,固然,也能夠放到任意目錄下,只是這樣編譯時須要指定該目錄。ui
[test@P-SH-Nginx-01 ~]$ cp -r ngx_http_dyups_module openresty-1.11.2.5lua
第一次就由於沒作這一步複製,最後報錯以下spa
adding module in /home/test/openresty-1.11.2.5/ngx_http_dyups_module
./configure: error: no /home/test/openresty-1.11.2.5/ngx_http_dyups_module/config was found
ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...
三、切換到Openresty最初下載解壓縮目錄下
[test@P-SH-Nginx-01]$ cd openresty-1.11.2.5
四、以管理員身份執行./configure --add-module,注意,必須以管理員身份,這個從新編譯過程很是長
[test@P-SH-Nginx-01 openresty-1.11.2.5]$ sudo ./configure --add-module=./ngx_http_dyups_module
編譯過程當中會不停刷屏顯示各類命令,均可以無視,但必定要注意最後的部分
…
adding module in ../rds-csv-nginx-module-0.07
+ ngx_http_rds_csv_filter_module was configured
adding module in /home/test/openresty-1.11.2.5/ngx_http_dyups_module
+ dyups module support lua
+ ngx_http_dyups_module was configured 這一句很關鍵,表示安裝成功了
checking for PCRE library ... found
checking for PCRE JIT support ... found
…
五、以管理員身份執行make
[test@P-SH-Nginx-01 openresty-1.11.2.5]$ sudo make
六、若是Nginx進程仍啓動中,則先關閉Nginx進程
七、切換到Make好的新文件所在目錄
[test@P-SH-Nginx-01 openresty-1.11.2.5]$ cd build
[test@P-SH-Nginx-01 build]$ cd nginx-1.11.2
[test@P-SH-Nginx-01 nginx-1.11.2]$ cd objs
八、查看Nginx是否關閉了
[test@P-SH-Nginx-01 objs]$ ps -ef |grep nginx
test 98103 77025 0 05:35 pts/0 00:00:00 grep --color=auto nginx
九、將新的Nginx文件複製到目標目錄
[test@P-SH-Nginx-01 objs]$ cp nginx /usr/local/openresty/nginx/sbin/
十、啓動Nginx並查看是否新Module加進去了
[test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -c conf/nginx.conf
[test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -V
nginx version: openresty/1.11.2.5
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: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --add-module=/home/test/openresty-1.11.2.5/ngx_http_dyups_module --with-http_ssl_module