https://openresty.org/cn/download.htmlhtml
https://github.com/yaoweibin/nginx_upstream_check_modulenginx
tar -zxvf openresty-1.13.6.1.tar.gzgit
unzip nginx_upstream_check_module-master.zipgithub
mv nginx_upstream_check_module-master openresty-1.13.6.1/bundlesql
cd openresty-1.13.6.1/bundle/nginx-1.13.6vim
patch -p1 < ../nginx_upstream_check_module-master/check_1.12.1+.patchapp
cd ../..post
yum -y install pcre-devel
yum -y install postgresql-devel
yum -y install openssl openssl-devel lua
./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/ -j8spa
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