Nginx之为已安装nginx动态添加模块的方法_nginx
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Nginx之为已安装nginx动态添加模块的方法_nginx,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1938字,纯文字阅读大概需要3分钟。
内容图文
![Nginx之为已安装nginx动态添加模块的方法_nginx](/upload/InfoBanner/zyjiaocheng/139/167198cb226e4192aa4843d15db36abb.jpg)
说明:
已经安装好的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/
相关推荐:
nginx相关知识点总结分享
nginx反向代理机制解决前端跨域问题
以上就是Nginx之为已安装nginx动态添加模块的方法_nginx的详细内容,更多请关注Gxl网其它相关文章!
内容总结
以上是互联网集市为您收集整理的Nginx之为已安装nginx动态添加模块的方法_nginx全部内容,希望文章能够帮你解决Nginx之为已安装nginx动态添加模块的方法_nginx所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。