段落1涉嫌违法被屏蔽
段落2涉嫌违法被屏蔽
环境:Ubuntu 12.04
安装:#apt-get install haproxy
修改 :#vi /etc/default/haproxy
ENABLED=1
配置:#vi /etc/haproxy/haproxy.cfg
global
ulimit-n 51200
defaults
log global
mode tcp
option dontlognull
contimeout 1000
clitimeout 150000
srvtimeout 150000
frontend ss-in
bind *:8008
default_backend ss-out
backend ss-out
server server1 XX.XX.XX.XX:8080 maxconn 20480
启动:#service haproxy start
上面的参数配置,8008 是国内VPS提供中转的端口, XX.XX.XX.XX:8080 是美国VPS的IP跟SS端口,本机配置SS的话,IP应该设置成国内VPS的,端口则是上面红色8008(也可以自由定义别的端口)
设置好了试一下,现在速度果然稳定多啦!
=========================
centos的安装方法如下:
环境:CentOS 6.5
安装:#yum -y install haproxy
配置:# vi /etc/haproxy/haproxy.cfg
global
ulimit-n? 51200
defaults
log global
mode??? tcp
option? dontlognull
timeout connect 1000
timeout client 150000
timeout server 150000
frontend ss-in
bind *:8008
default_backend ss-out
backend ss-out
server server1 XX.XX.XX.XX:8080 maxconn 20480
启动:#service haproxy start
补充:
1、如果无法代理,请检查防火墙是否开启8008端口:#service iptables status
2、如需开机启动,使用命令:#chkconfig haproxy on
=========================
补充:
如出现如下错误:
正在启动 haproxy:
[WARNING] 242/225203 (1334) : parsing [/etc/haproxy/haproxy.cfg:7] : the ‘contimeout’ directive is now depcated in favor of ‘timeout connect’, and will not be supported in future versions.
[WARNING] 242/225203 (1334) : parsing [/etc/haproxy/haproxy.cfg:8] : the ‘clitimeout’ directive is now depcated in favor of ‘timeout client’, and will not be supported in future versions.
[WARNING] 242/225203 (1334) : parsing [/etc/haproxy/haproxy.cfg:9] : the ‘srvtimeout’ directive is now depcated in favor of ‘timeout server’, and will not be supported in future versions.
请检查修改第7~9行的参数,haproxy 新版本的参数写法有变动,所以配置文件也需要修改,上述测试例子中,Ubuntu 的是旧版本,CentOS的是新版本,比较一下就可以看出来了!