• nginx跟haproxy四层反代exchange端口


    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;
           }
    }
  • 相关阅读:
    typeof用法
    图片上传显示图片
    用Express 创建项目
    Express中使用session
    生成一个node项目
    async同步异步
    async异步流程控制
    nodejs并行无关联
    nodejs串行有关联
    nodejs串行无关联
  • 原文地址:https://www.cnblogs.com/allmdzz/p/11194784.html
Copyright © 2020-2023  润新知