博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx跟haproxy四层反代exchange端口
阅读量:5008 次
发布时间:2019-06-12

本文共 3867 字,大约阅读时间需要 12 分钟。

haproxy:

global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     40000
    user        haproxy
    group       haproxy
    daemon
    stats socket /var/lib/haproxy/stats
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000
listen stats
bind  0.0.0.0:1080
stats enable
stats hide-version
stats uri /haproxyadmin
stats auth admin:admin
stats admin if TRUE
frontend  mail_443
bind :443
mode tcp
default_backend   mail_443_bg     
backend mail_443_bg
    balance     roundrobin
    mode        tcp
    #option      httpchk GET /index.php
    server  lnmpserver1 172.17.1.65:443 check inter 3000 rise 3 fall 5
    server  lnmpserver2 172.17.1.66:443 check inter 3000 rise 3 fall 5
frontend  mail_25
bind :25
mode tcp
default_backend         mail_25_bg
backend mail_25_bg
    balance     roundrobin
    mode        tcp
    #option      httpchk GET /index.php
    server  lnmpserver1 172.17.1.65:25 check inter 3000 rise 3 fall 5
    server  lnmpserver2 172.17.1.66:25 check inter 3000 rise 3 fall 5
frontend  mail_110
bind :110
mode tcp
default_backend         mail_110_bg
backend mail_110_bg
    balance     roundrobin
    mode        tcp
    #option      httpchk GET /index.php
    server  lnmpserver1 172.17.1.65:110 check inter 3000 rise 3 fall 5
    server  lnmpserver2 172.17.1.66:110 check inter 3000 rise 3 fall 5
frontend  mail_587
bind :587
mode tcp
default_backend         mail_587_bg
backend mail_587_bg
    balance     roundrobin
    mode        tcp
    #option      httpchk GET /index.php
    server  lnmpserver1 172.17.1.65:587 check inter 3000 rise 3 fall 5
    server  lnmpserver2 172.17.1.66:587 check inter 3000 rise 3 fall 5
frontend  mail_995
bind :995
mode tcp
default_backend         mail_995_bg
backend mail_995_bg
    balance     roundrobin
    mode        tcp
    #option      httpchk GET /index.php
    server  lnmpserver1 172.17.1.65:995 check inter 3000 rise 3 fall 5
    server  lnmpserver2 172.17.1.66:995 check inter 3000 rise 3 fall 5
___________________________________________________________________________________________________
 
nginx---nginx编译安装的时候要把这些模块带上--with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module
 
 
 
user  nginx;
worker_processes  2;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  30000;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  65;
    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
}
stream {
  upstream mail_443 {
        server 172.17.1.66:443  max_fails=3 fail_timeout=30s;
        server 172.17.1.65:443 max_fails=3 fail_timeout=30s;
 }
 
  upstream mail_25 {
        server 172.17.1.66:25  max_fails=3 fail_timeout=30s;
        server 172.17.1.65:25 max_fails=3 fail_timeout=30s;
 }
  upstream mail_110 {
        server 172.17.1.66:110  max_fails=3 fail_timeout=30s;
        server 172.17.1.65:110 max_fails=3 fail_timeout=30s;
 }
  upstream mail_587 {
        server 172.17.1.66:587  max_fails=3 fail_timeout=30s;
        server 172.17.1.65:587 max_fails=3 fail_timeout=30s;
 }
  upstream mail_995 {
        server 172.17.1.66:995  max_fails=3 fail_timeout=30s;
        server 172.17.1.65:995 max_fails=3 fail_timeout=30s;
 }
server {
        listen 443;
        proxy_connect_timeout 5s;
        proxy_timeout 5s;
        proxy_pass mail_443;
       }
server {
        listen 25;
        proxy_connect_timeout 5s;
        proxy_timeout 5s;
        proxy_pass mail_25;
       }
server {
        listen 110;
        proxy_connect_timeout 5s;
        proxy_timeout 5s;
        proxy_pass mail_110;
       }
server {
        listen 587;
        proxy_connect_timeout 5s;
        proxy_timeout 5s;
        proxy_pass mail_587;
       }
server {
        listen 995;
        proxy_connect_timeout 5s;
        proxy_timeout 5s;
        proxy_pass mail_995;
       }
}

转载于:https://www.cnblogs.com/allmdzz/p/11194784.html

你可能感兴趣的文章
HW2.2
查看>>
将Windows Server 2016 打造成工作站(20161030更新)
查看>>
5大主浏览器css3和html5兼容性大比拼
查看>>
常用正则表达示
查看>>
解决Oracle在命令行下无法使用del等键问题
查看>>
获取web项目的绝对路径的方法总结
查看>>
nodejs批量处理图片
查看>>
c# 复制整个文件夹的内容,Copy所有文件
查看>>
30秒js练习(数组篇) 更新中。。。
查看>>
hdu-5894 hannnnah_j’s Biological Test(组合数学)
查看>>
hdu-4810 Wall Painting(组合数学)
查看>>
企业互联网服务介绍
查看>>
【推荐】iOS中书写代码规范34条小建议
查看>>
AJAX请求头Content-type
查看>>
3.html基础标签:表格
查看>>
python操作Redisl数据库
查看>>
NSArray & NSDictionary
查看>>
解决使用maven的java web项目导入后出现的有关问题 -cannot be read or is not a valid ZIP file...
查看>>
js yield
查看>>
HBase基本操作
查看>>