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. Freewheel Tech interview

    1.聊背景.. 2.聊项目..然饿我的项目是webvr..基本面试官很少会了解这个..应该再多做实习多做些项目.. 3.浏览器输入网址后到页面呈现出来的过程 4.缓存机制, 浏览器如何判断一个图片有没 ...

  2. 视频图像处理基础知识5(RGB与Ycbcr相互转换公式 )【转】

    转自:http://blog.csdn.net/Times_poem/article/details/51471438 版权声明:本文为博主原创文章,未经博主允许不得转载. 需求说明:视频处理算法基本 ...

  3. 1.tornado实现高并发爬虫

    from pyquery import PyQuery as pq from tornado import ioloop, gen, httpclient, queues from urllib.pa ...

  4. 项目问题整理(it)

    1,很(屎)优(一)雅(样)的IE9兼容问题: --webuploader在webkit浏览器中自动使用h5上传,但在IE中需要配置支持flash,特别注意两点: ①Upload.swf路径问题不正确 ...

  5. servletcontext.getRealPath()

    getRealPath方法已经不建议使用了: http://blog.csdn.net/lzynihao/article/details/8315796 另外:http://veryls.iteye. ...

  6. Selenium2+python自动化73-定位的坑:class属性有空格【转载】

    前言 有些class属性中间有空格,如果直接复制过来定位是会报错的InvalidSelectorException: Message: The given selector u-label f-dn ...

  7. pipreqs------查找python项目依赖并生成requirements.txt

    项目开发的时候,总是要搭建和部署环境,这时,就需要一个python第三方包的list,一般叫做requirements.txt.如果项目使用virtualenv环境,直接使用pip freeze即可, ...

  8. Response 部分功能

    设置状态码的方法:    void setStatus(int sc)     void setStatus(int sc, String sm) 设置响应头的方法:    void setHeade ...

  9. A - Enterprising Escape 【BFS+优先队列+map】

    The Enterprise is surrounded by Klingons! Find the escape route that has the quickest exit time, and ...

  10. 洛谷——P1033 自由落体

    P1033 自由落体 题目描述 在高为 H 的天花板上有 n 个小球,体积不计,位置分别为 0,1,2,….n-1.在地面上有一个小车(长为 L,高为 K,距原点距离为 S1).已知小球下落距离计算公 ...