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. MyBatis系列三 之 使用getMapper剔除掉Dao的实现类

    MyBatis系列三  之  使用getMapper剔除掉Dao的实现类 我们在系列一 中 我们使用的是Dao的实现类   来操作底层数据库,今天我们使用getMapper()来替换Dao的实现类, ...

  2. 类似web风格的 Winform 分页控件

    背景 最近做一个Winform的小程序,需要用到分页,由于之前一直在用 TonyPagerForWinForm.dll ,但该库没有源代码,网上找的也不全面,索性就准备自己改造一个.在园子里翻了一下, ...

  3. HTTP===http首部字段

    HTTP 首部字段 HTTP 首部字段是构成 HTTP 报文的要素之一.在客户端与服务器之间以 HTTP 协议进行通信的过程中,无论是请求还是响应都会使用首部字段,它能起到传递额外重要信息的作用. 使 ...

  4. python基础===socket模块的讲解(转)

    一.网络知识的一些介绍 socket 是网络连接端点.例如当你的Web浏览器请求www.jb51.net上的主页时,你的Web浏览器创建一个socket并命令它去连接 www.jb51.net的Web ...

  5. (五)对linux内核中jiffies+Hz表示一秒钟的理解

    jiffies在内核中是一个全局变量,它用来统计系统启动以来系统中产生的总节拍数,这个变量定义在include/Linux/jiffies.h中,定义形式如下. unsigned long volat ...

  6. KVM的qemu-kvm使用

    KVM: kvm,x86支持硬件辅助虚拟化技术(hvm) grep -E "(vmx|svm)" /proc/cpuinfo [root@dmsag ~]# ll /dev/kvm ...

  7. svn泄漏敏感信息利用方式

    之前仅知道svn权限配置不当,会导致敏感信息泄漏,但是一直不知道具体利用方式. 今天测试svn dig时抓包分析才知道: http://www.xxx.com/路径/.svn/text-base/文件 ...

  8. Spark GraphX宝刀出鞘,图文并茂研习图计算秘笈与熟练的掌握Scala语言【大数据Spark实战高手之路】

    Spark GraphX宝刀出鞘,图文并茂研习图计算秘笈 大数据的概念与应用,正随着智能手机.平板电脑的快速流行而日渐普及,大数据中图的并行化处理一直是一个非常热门的话题.图计算正在被广泛地应用于社交 ...

  9. [jquery] ajax parsererror

    http://stackoverflow.com/questions/5061310/jquery-returning-parsererror-for-ajax-request 方法一: 直接去掉 d ...

  10. sqlmap的小试牛刀

    这次算是一次用sqlmap的例子,写的很水. 目的:通过工具扫描到了后台的数据库的地址(如下图),想通过sqlmap找到数据库的用户和密码进入到数据库(首先可以尝试一下root:root一般都是这个情 ...