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. [BZOJ1040] [ZJOI2008]骑士 解题报告

    Description Z国的骑士团是一个很有势力的组织,帮会中汇聚了来自各地的精英.他们劫富济贫,惩恶扬善,受到社会各界的赞扬.最近发生了一件可怕的事情,邪恶的Y国发动了一场针对Z国的侵略战争.战火 ...

  2. [bzoj3004][SDOI2012]吊灯——樹形DP

    Brief Description 給定一棵樹, 判斷是否可以將其分成\(\frac{n}{k}\)個聯通塊, 其中每個聯通塊的大小均爲k. Algorithm Design 我們有一個結論: k可行 ...

  3. Codeforces 219D Choosing Capital for Treeland 2次DP

    //选择一个根使得变换最少边的方向使得能够到达所有点#include <map> #include <set> #include <list> #include & ...

  4. Oracle expdp

    exp                客户端工具expdp             服务端工具 expdp help=y  帮助命令directory         导出目录逻辑名 --查询默认数据 ...

  5. js实现双指缩放图片 手机端双指缩放图片

    首先引入js文件,需要jq,pinchzoom.js.pinchzoom.js需要在jq环境下使用,可以 <meta name="viewport" content=&quo ...

  6. 在表达式和脚本中将bean实例暴露出来

    默认情况下,在activiti.cfg.xml中的所有bean和Spring配置文件中的所有bean都可以用于表达式和脚本.如果要限制配置文件中的bean的可见性,可以在流程引擎配置文件中配置一个名为 ...

  7. python multiprocessing多进程模块

    原文:https://blog.csdn.net/CityzenOldwang/article/details/78584175 多进程 Multiprocessing 模块 multiprocess ...

  8. PO/POJO/BO/DTO/VO的区别(转)

    PO :persistent object持久对象 1 .有时也被称为Data对象,对应数据库中的entity,可以简单认为一个PO对应数据库中的一条记录. 2 .在hibernate持久化框架中与i ...

  9. sonarQube6.1 升级至6.2

    在使用sonarQube6.1一段时间后,今天才发现sonarQube6.2已经更新,为了尝鲜,我决定在本机先尝试一下,如何升级至6.2 在这里,根据站点提示的升级步骤 1.下载新版本sonarQub ...

  10. jQuery.Easyui 三层菜单的实现

    有图才有真相: 三层导航菜单JSON 数据格式如下: ].panel('options').title;    $('#wnav').accordion('select', t); } // 初始化左 ...