最新消息:这里是最新消息

已编译安装的nginx添加模块(反向代理wiki.google)

总结笔记 benty 507浏览 0评论

简介

今天搭建网站的时候发现原来编译好的nginx中没有我需要的模块,这个时候就需要往nginx中动态的添加模块了

操作

首先看一下自己现在的nginx版本

[root@vultr src]# nginx -V
nginx version: nginx/1.10.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module

上面有编译的参数,这个很重要
之后下载对应的nginx版本,解压
tar -zxvf nginx-1.10.0.tar.gz
下载模块
git clone https://github.com/cuber/ngx_http_google_filter_module
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
cd nginx-1.10.0
接着编译,编译的时候要加入要增加模块只要在编译的时候添加–add-module后面加上模块路径就好了

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --add-module=../ngx_http_google_filter_module --add-module=../ngx_http_substitutions_filter_module

接着make记住不能make install
之后替换nginx二进制文件
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
cp objs/nginx /usr/local/nginx/sbin/
测试新的nginx是否正确

[root@vultr sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

重启服务器
sudo service nginx reload

完成
Have Fun

————————————————

这篇文档很有用
————
作者:bboysoul
链接:https://www.jianshu.com/p/7928278db041
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
==================
另外收藏一个you222php,这个东西挺好用
还有上面文章主要是给安装nginx的一个ngx_http_substitutions_filter_module模块做铺垫用的,用来正向代理一些需要的网站,
搭建google代理站(这里面有两个模块,一个是google写好的模块),还有wiki网站可以好好研究一下.

编译nginx的源码安装subs_filter模块

wiki的github的nginx配置conf


好了,这就是这两天总结的东西,应该够消化了,去吃饭加个鸡腿奖赏自己是可以的!

转载请注明:稻香的博客 » 已编译安装的nginx添加模块(反向代理wiki.google)

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址