Nginx第三方模块Ngx-dyups安装过程

Ngx-dyups是什么,能干什么

它是一个Nginx第三方动态Upstream配置模块,可以实现在不重启Nginx情况下动态更新反向代理Upstream表。该模块由淘宝开发团队维护,淘宝自家的Tengine中虽然没有直接集成该模块,但可以通过重新编译方式加进去。

源码地址

https://github.com/yzprofile/ngx_http_dyups_module

 

Ngx-dyups安装 

1、下载第三方模块

git clone git://github.com/yzprofile/ngx_http_dyups_module.git

2、将第三方模块目录复制到最初Openresty下载解压缩目录下,当然,也可以放到任意目录下,只是这样编译时需要指定该目录。

[test@P-SH-Nginx-01 ~]$ cp -r  ngx_http_dyups_module openresty-1.11.2.5

第一次就因为没做这一步复制,最后报错如下

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 \...

3、切换到Openresty最初下载解压缩目录下

[test@P-SH-Nginx-01]$ cd openresty-1.11.2.5

4、以管理员身份执行./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

5、以管理员身份执行make

[test@P-SH-Nginx-01 openresty-1.11.2.5]$ sudo make

6、如果Nginx进程仍启动中,则先关闭Nginx进程

7、切换到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

8、查看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

9、将新的Nginx文件复制到目标目录

 [test@P-SH-Nginx-01 objs]$ cp nginx /usr/local/openresty/nginx/sbin/

10、启动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

猜你喜欢

转载自www.cnblogs.com/PowerDesigner/p/10213045.html
今日推荐