2016年7月10日星期日

haproxy gmail

apt-get install haproxy

vim /etc/default/haproxy
Set the ENABLED option to 1
service haproxy

/etc/haproxy/haproxy.cfg

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        user haproxy
        group haproxy
        daemon

defaults
        log     global
        mode    tcp
        option  dontlognull
        contimeout 5000
        clitimeout 50000
        srvtimeout 50000


listen smtp
    bind 0.0.0.0:2014
    mode tcp
    log  global
    server s1 smtp.gmail.com:465

listen pop
    bind 0.0.0.0:2015
    mode tcp
    log global
    server s2 pop.gmail.com:995

listen imap
    bind 0.0.0.0:2016
    mode tcp
    log global
    server s3 imap.gmail.com:993


global
    log         127.0.0.1 local2 
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will 
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    log global
    mode    tcp
    option  dontlognull
    timeout connect 1000
    timeout client 150000
    timeout server 150000
    maxconn     60000
    retries     3

listen smtp
    bind *:465
    mode tcp
    log  global
    server s1 smtp.gmail.com:465
 
listen pop
    bind *:995
    mode tcp
    log global
    server s2 pop.gmail.com:995
 
listen imap
    bind *:993
    mode tcp
    log global
    server s3 imap.gmail.com:993

没有评论:

发表评论