yum -y install git
yum -y install patch
yum -y install pcre-devel
yum install -y zlib-devel
 
mkdir /opt/nginx/ && cd /opt/nginx/
 
wget https://openresty.org/download/openresty-1.9.15.1.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.8.6.tar.gz
 
tar xf xxx.tar.gz
 
git clone https://github.com/yaoweibin/nginx_upstream_check_module.git
 
cp -a nginx_upstream_check_module /opt/nginx/openresty-1.9.15.1/bundle/nginx-1.9.15/
cd /opt/nginx/openresty-1.9.15.1/bundle/nginx-1.9.15/
patch -p0 < /opt/nginx/openresty-1.9.15.1/bundle/nginx-1.9.15/nginx_upstream_check_module/check_1.9.2+.patch
 
 
cd /opt/nginx/openresty-1.9.15.1/
./configure --prefix=/usr/local/verynginx --user=nginx --group=nginx --with-http_v2_module --with-http_sub_module --with-http_stub_status_module --with-luajit --with-openssl=/opt/nginx/openssl-1.0.2l --add-module=/opt/nginx/openresty-1.9.15.1/bundle/nginx-1.9.15/nginx_upstream_check_module/
make -j 4
make install
cd .. &&  cp –a VeryNginx/veryNginx /usr/local/vnginx/  &&  chown -R nginx:nginx /usr/local/vnginx/verynginx
 
vim nginx.conf
 
  1. user nginx;
  2. worker_processes auto;
  3. #daemon off;   #如果要在docker运行,加这个参数让nginx在前台运行
  4. error_log logs/error.log;
  5. error_log logs/error.log notice;
  6. error_log logs/error.log info;
  7. pid logs/nginx.pid;
  8. events {
  9. worker_connections 1024;
  10. }
  11. include /usr/local/verynginx/verynginx/nginx_conf/in_external.conf;
  12. http {
  13. include mime.types;
  14. default_type application/octet-stream;
  15. log_format access '$host $remote_addr - - $time_local "$request" "$http_referer" "$http_user_agent" $body_bytes_sent "$http_x_forwarded_for" $request_length $status $request_time';
  16. sendfile on;
  17. keepalive_timeout 65;
  18. client_body_buffer_size 128k;
  19. gzip on;
  20. include /usr/local/verynginx/verynginx/nginx_conf/in_http_block.conf;
  21. # include /usr/local/verynginx/nginx/conf/vhosts/*.conf;
  22. server {
  23. listen 80;
  24. include /usr/local/verynginx/verynginx/nginx_conf/in_server_block.conf;
  25. location = / {
  26. root html;
  27. index index.html index.htm;
  28. }
  29. }
  30. include /usr/local/verynginx/nginx/conf/vhosts/*.conf;
  31. }

mkdir -p /usr/local/verynginx/nginx/conf/vhosts/

 
vim t.conf
upstream nsignature {
server 127.0.0.1:9998 weight=1;
server 127.0.0.1:9998 weight=1;
check interval=3000 rise=2 fall=5 timeout=1000;
check_http_send "GET /1 HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 80;
server_name test.xxx.cn;
location /{
proxy_pass http://nsignature;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /nstatus {
check_status;
access_log off;
allow all;
}
access_log /var/log/test.log access;
}
 
vim /usr/local/verynginx/verynginx/nginx_conf/in_http_block.conf
upstream vn_upstream{
server 127.0.0.1;
balancer_by_lua_file /usr/local/verynginx/verynginx/lua_script/on_banlance.lua;
keepalive 1024; #Connection pool
}
lua_package_path '/usr/local/verynginx/verynginx/lua_script/?.lua;;/usr/local/verynginx/verynginx/lua_script/module/?.lua;;';
lua_package_cpath '/usr/local/verynginx/verynginx/lua_script/?.so;;';
lua_code_cache on;
lua_shared_dict status 1m;
lua_shared_dict frequency_limit 10m;
lua_shared_dict summary_long 10m;
lua_shared_dict summary_short 10m;
init_by_lua_file /usr/local/verynginx/verynginx/lua_script/on_init.lua;
rewrite_by_lua_file /usr/local/verynginx/verynginx/lua_script/on_rewrite.lua;
access_by_lua_file /usr/local/verynginx/verynginx/lua_script/on_access.lua;
log_by_lua_file /usr/local/verynginx/verynginx/lua_script/on_log.lua;

verynginx +nginx_upstream_check_module模块,负载均衡检查模块。的更多相关文章

  1. [转帖]nginx upstream模块--负载均衡

    nginx upstream模块--负载均衡 https://www.cnblogs.com/linjiqin/p/5494783.html Module ngx_http_upstream_modu ...

  2. nginx upstream模块--负载均衡

    Module ngx_http_upstream_module英文文档 upstream模块相关说明1.upstream模块应放于nginx.conf配置的http{}标签内2.upstream模块默 ...

  3. 基于LNMP(fastcgi协议)环境部署、原理介绍以及fastcgi_cache配置以及upstream模块负载均衡讲解

    ngx_http_proxy_module只能反向代理后端使用HTTP协议的主机.而ngx_http_fastcgi_module只能反向代理后端使用FPM或者使用FastCGI协议的客户端. 一.部 ...

  4. nginx负载均衡fair模块安装和配置

    nginx-upstream-fair-master fair模块源码 官方github下载地址:https://github.com/gnosek/nginx-upstream-fair说明:如果从 ...

  5. 【Web】Nginx 反向代理与负载均衡

    反向代理 反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客 ...

  6. Nginx负载均衡设置max_fails和fail_timeout

    在Nginx的负载均衡检查模块中,对于负载均衡的节点可以配置如下可选参数: max_fails=1 fail_timeout=10s 这个是Nginx在负载均衡功能中,用于判断后端节点状态,所用到两个 ...

  7. Nginx负载均衡策略

    目前nginx负载均衡支持的5种方式的分配 1. 轮询 每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除. upstream backserver { server ...

  8. Nginx安装负载均衡配置 fair check扩展

    前言 本文主要是针对Nginx安装.负载均衡配置,以及fair智能选举.check后端节点检查扩展功能如何扩展,进行讲解说明. fair模块: upstream-fair,“公平的”Nginx 负载均 ...

  9. linux负载均衡总结性说明(四层负载/七层负载)

    在常规运维工作中,经常会运用到负载均衡服务.负载均衡分为四层负载和七层负载,那么这两者之间有什么不同?废话不多说,详解如下: 一,什么是负载均衡1)负载均衡(Load Balance)建立在现有网络结 ...

随机推荐

  1. CF502C The Phone Number

    C. The Phone Number time limit per test 1 second memory limit per test 256 megabytes     Mrs. Smith ...

  2. [bzoj2763][JLOI2011]飞行路线——分层图最短路

    水题.不多说什么. #include <bits/stdc++.h> using namespace std; const int maxn = 10010; const int maxk ...

  3. JS形参与实参问题

    JavaScript的参数传递也都是采用值传递的方式进行传值. (1)     通过实参调用函数的时候,传入函数里的是实参的副本而不是实参,因此在函数里面修改参数值并不会对实参造成影响. 例如:将全局 ...

  4. algorithm ch15 FastWay

    这是DP最基础的一个问题,刚开始学习这一块,实现了一下,不要黑我巨长的参数表,新手. 代码如下: void FastWay(int l1[], int l2[], int e1, int e2, in ...

  5. Swift 枚举(七)

    http://blog.csdn.net/huangchentao/article/details/32714621 枚举 1.枚举语法 用enum并把定义放在大括号内,枚举中被定义的值是枚举的成员, ...

  6. C++类中引用成员和常量成员的初始化(初始化列表)

    如果一个类是这样定义的: Class A { public: A(int pram1, int pram2, int pram3); privite: int a; int &b; const ...

  7. python的上下文管理(context)(1)

    本文转载自:http://blog.csdn.net/G_66_hero/article/details/53048540 什么是Python中的上下文管理器 怎么使用上下文管理器 如何创建自己的上下 ...

  8. 控件gridview的属性全集

    1. GridView控件的属性 表10.6 GridView控件的行为属性 属性 描述 AllowPaging 指示该控件是否支持分页. AllowSorting 指示该控件是否支持排序. Auto ...

  9. flutte 命令行指令卡死

  10. poj3233(等比矩阵求和)

    poj3233 题意 给出一个 \(n \times n\) 的矩阵 \(A\) ,求 \(A + A^2 + A^3 + ... + A^k\) . 分析 构造矩阵 \[ \begin{bmatri ...