• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Openresty+Nginx+Lua+Nginx_http_upstream_check_module搭建

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
  • 下载Openresty与Nginx_http_upstream_check_module

https://openresty.org/cn/download.html

https://github.com/yaoweibin/nginx_upstream_check_module

  • 解压Openresty

tar -zxvf openresty-1.13.6.1.tar.gz

  • 解压Nginx_http_upstream_check_module到openresty-1.13.6.1/bundle

unzip nginx_upstream_check_module-master.zip

mv nginx_upstream_check_module-master openresty-1.13.6.1/bundle

  • 加补丁Nginx_http_upstream_check_module

cd openresty-1.13.6.1/bundle/nginx-1.13.6

patch -p1 < ../nginx_upstream_check_module-master/check_1.12.1+.patch

cd ../..

  • 安装依赖

yum -y install pcre-devel
yum -y install postgresql-devel
yum -y install openssl openssl-devel 

  • 配置

./configure --prefix=/opt/soft/nginx --with-luajit --with-http_iconv_module --with-http_postgres_module --with-pcre --add-module=./bundle/nginx_upstream_check_module-master/ -j8

  • 编译安装

make -j8 && make install

  • 配置

vim /opt/soft/nginx/nginx/conf/nginx.conf


pid        logs/nginx.pid;

events {
    worker_connections  102400;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$time_local|$request_time|$upstream_response_time|$http_x_forwarded_for|$remote_addr|$upstream_addr|$server_addr|'
    '$http_host|$request|$status|$body_bytes_sent|$http_referer|$http_user_agent';
access_log logs/access.log  main; sendfile on; keepalive_timeout 5; lua_code_cache on; lua_package_path '/opt/soft/nginx/lualib/?.lua;;'; lua_package_cpath '/opt/soft/nginx/lualib/?.so;;'; server { listen 9595; server_name localhost; location / { root html; index index.html index.htm; } location /nstatus { check_status; access_log off; #allow SOME.IP.ADD.RESS; #deny all; } } upstream test { server 192.168.0.21:80; server 192.168.0.22:80; check interval=3000 rise=2 fall=5 timeout=1000; check_http_send "GET /ip=127.0.0.1 HTTP/1.0\r\n\r\n"; check_http_expect_alive http_2xx; } }

 

参考文献:

https://openresty.org/cn/installation.html

https://www.cnblogs.com/zdz8207/p/Nginx-Lua-OpenResty.html

http://blog.csdn.net/moqiang02/article/details/42846375

http://jinnianshilongnian.iteye.com/blog/2186270

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
centos安装lua发布时间:2022-07-22
下一篇:
Python、Lua和Ruby三大语言脚本哪家强?发布时间:2022-07-22
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap