设为首页 收藏本站
查看: 1446|回复: 0

[经验分享] openresty+lua+nginx_upstream_check_module等其他模块安装

[复制链接]

尚未签到

发表于 2018-11-13 13:33:02 | 显示全部楼层 |阅读模式
Openresty、Lua、nginx_upstream_check_module等其他模块安装
  1.   软件
  LuaJIT
  LuaJIT-2.1.0-beta2.tar.gz
  Openresty
  Openresty-1.9.15.1.tar.gz
  Nginx_upstream_check_module
  nginx_upstream_check_module-master.zip
  https://github.com/yaoweibin/nginx_upstream_check_module
  NGINX后端服务负载均衡健康检查
  nginx_http_push_module-master
  nginx_http_push_module-master.zip
  https://github.com/slact/nchan;  https://nchan.io
  实现服务器端的长连接和推送
  ngx_python-master
  ngx_python-master.zip
  https://github.com/rryqszq4/ngx_python
  在NGINX中使用PYTHON语言
  ngx_lua_waf-master
  ngx_lua_waf-master.zip
  https://github.com/loveshell/ngx_lua_waf?utm_source=tuicool&utm_medium=referral
  基于lua-nginx-module(openresty)的web应用防火墙
  VeryNginx-master
  VeryNginx-master.zip
  https://github.com/alexazhou/VeryNginx#want-using-custom-nginx
  提供NGINX 维护监控
  其他第三方模块请参见
  https://www.nginx.com/resources/wiki/modules/
  其他依赖包
  openssl-1.0.0e.tar.gz
  pcre-8.10.tar.gz
  zlib-1.2.5.tar.gz
  安装软件时系统需要的支持包
  gcc
  gcc-c++
  python2.7
  python2.7-devel
  2.  系统支持包检查和安装
  略
  3.      安装
  ⑴  将软件拷贝到目录(例如/tmp)下,并解压
  目录结构如下:/tmp
  |-----LuaJIT-2.1.0-beta2
  |----- Openresty-1.9.15.1
  |----- nginx_upstream_check_module-master
  |----- nginx_http_push_module-master
  |----- ngx_python-master
  |----- ngx_lua_waf-master
  |----- VeryNginx-master
  |----- openssl-1.0.0e
  |----- pcre-8.10
  |----- zlib-1.2.5
  ⑵  Luajit安装
  Cd  /tmp/ LuaJIT-2.1.0-beta2
  Make  &&  make install
  ⑶ 安装nginx_upstream_check_module模块
  Cd  nginx_upstream_check_module-master
  根据README中的提示进行安装
  Cd  /tmp/openresty-1.9.15.1/bundle/nginx-1.9.15
  patch -p1 < /tmp/nginx_upstream_check_module-master/check_1.9.2+.patch
  如果报错可以试下
  patch -p0 < /tmp/nginx_upstream_check_module-master/check_1.9.2+.patch
  如果NGINX版本是1.9.2及以上就使用check_1.9.2+.patch
DSC0000.jpg

  ⑶ 安装openresty到指定目录(/webapp/openresty)
  并安装附加模块:nginx_upstream_check_module-master
  nginx_http_push_module-master
  ngx_python-master
  Cd  /tmp/openresty-1.9.15.1/
  ./configure--prefix=/webapp/openresty   \
  --with-http_stub_status_module  \
  --with-http_ssl_module \
  --with-http_addition_module \
  --with-http_realip_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --with-zlib=/tmp/zlib-1.2.5 \
  --with-pcre=/tmp/pcre-8.10  \
  --with-openssl=/tmp/openssl-1.0.0e\
  --add-module=/tmp/nginx_upstream_check_module-master\ #安装时指定模块
  --add-module=/tmp/nginx_http_push_module-master \ #安装时指定模块
  --add-module=/tmp/ngx_python-master\ #安装时指定模块
  --user=webapp  --group=webapp
DSC0001.jpg

  gmake
  如果出现Python.h 文件不存在 的错误。
  执行cp -R/usr/local/include/python2.7   /usr/include/
  或者$export PYTHON_INC=/path/to/python/include/python2.7
  $ export PYTHON_BIN=/path/to/python/bin
  在重新configure,gmake
  gmake  install
  openresty安装完成
  ⑷ 验证
  Cd  /webapp/openresty/nginx/sbin
  ./nginx -V
DSC0002.jpg

  ⑸ 安装ngx_lua_waf-master模块
  将ngx_lua_waf-master里的文件拷贝到openresty的nginx/conf/waf目录下
  Mv  /tmp/ngx_lua_waf-master/*    /webapp/openresty/nginx/conf/waf
  在nginx.conf的http段添加
  lua_package_path "/webapp/openresty/nginx/conf/waf/?.lua";
  lua_shared_dict limit 10m;
  init_by_lua_file  /webapp/openresty/nginx/conf/waf/init.lua;
  access_by_lua_file /webapp/openresty/nginx/conf/waf/waf.lua;
  配置config.lua里的waf规则目录(一般在waf/conf/目录下)
  RulePath = "/webapp/openresty/nginx/conf/waf/wafconf/"
  当访问http://192.168.4.198/wwwroot.rar
DSC0003.jpg

  ⑹ 安装VeryNginx-master模块
  Cd   /tmp/VeryNginx-master
       python install.py install verynginx         安装目录默认在   /opt/verynginx/         Nginx.conf配置:         ……         include /opt/verynginx/verynginx/nginx_conf/in_external.conf;         http {             ……             include /opt/verynginx/verynginx/nginx_conf/in_http_block.conf;             server {                    ……                    include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf;                    }             }          访问  http://127.0.0.1/verynginx/index.html      User / Password: verynginx / verynginx  ⑺  使用Ngx_python模块
  在NGINX.conf文件中添加
DSC0004.jpg

  ⑻ 使用nginx_http_push_module-master模块
  http://www.cnblogs.com/caosiyang/archive/2012/03/31/2426625.html
  Nginx.conf配置文件中添加
  location = /sub{
  set$push_channel_id $arg_id;
  push_subscriber;
  push_subscriber_concurrency broadcast;
  push_channel_group broadcast;
  }
  location= /pub {
  set$push_channel_id $arg_id;
  push_publisher;
  push_min_message_buffer_length 5;
  push_max_message_buffer_length 20;
  push_message_timeout 5s;
  push_channel_group broadcast;
  }
  启动Nginx,使用curl进行推送测试
  1) subscriber请求数据:
  curl -X GET localhost:8082/sub?id=1
  向channel1请求数据,当前channel无数据,等待数据生成
  2) publisher推送数据:
  curl -X POST -d "data_to_push" localhost:8082/pub?id=1
  向channel1推送数据,subscriber收到数据并返回



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-634644-1-1.html 上篇帖子: HTTPS协议介绍—使用Nginx+SSL实现部署与性能优化 下篇帖子: nginx proxy_pass末尾神奇的斜线
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表