前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >已安装Nginx动态添加模块

已安装Nginx动态添加模块

作者头像
星哥玩云
发布2022-07-13 13:05:51
4770
发布2022-07-13 13:05:51
举报
文章被收录于专栏:开源部署

说明: 已经安装好的nginx,需要添加一个未被编译安装的模块,需要怎么弄呢?

具体: 这里以安装第三方ngx_http_google_filter_module模块为例 nginx的模块是需要重新编译nginx,而不是像apache一样配置文件引用.so 1. 下载第三方扩展模块ngx_http_google_filter_module # cd /data/software/ # git clone https://github.com/cuber/ngx_http_google_filter_module

2. 查看nginx编译安装时安装了哪些模块 # nginx -V nginx version: nginx/1.8.0 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module

可以看出编译安装使用了--prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module这些参数。--add-module=/data/software/ngx_http_substitutions_filter_module是之前编译添加ngx_http_substitutions_filter_module模块时添加

3. 加入需要安装的模块,重新编译,如这里添加–add-module=/data/software/ngx_http_google_filter_module # ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module --add-module=/data/software/ngx_http_google_filter_module # make    //千万不要make install,不然就真的覆盖了

4. 替换nginx二进制文件: # cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak # cp ./objs/nginx /usr/local/nginx/sbin/

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档