Openresty+Nginx+Lua+Nginx_http_upstream_check_module 搭建

  • 下载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/vhosts/rcm.confworker_processes 16;

error_log  logs/error.log;
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

 

转载于:https://www.cnblogs.com/jhc888007/p/8523164.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值