deb http://ftp.us.debian.org/debian/ wheezy-backports main
apt-get update apt-get install haproxy
vi /etc/haproxy/haproxy.cfg
global
defaults
log global
mode tcp
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend ss-in
bind *:6666
default_backend ss-out
backend ss-out
server server1 233.233.233.233 maxconn 20480
frontend ss-in
bind *:10000-30000
default_backend ss-out
backend ss-out
server server1 233.233.233.233 maxconn 20480
HaProxy 1.5版本后也支持了ipv6,把这里的 233.233.233.233 换成 ipv6地址 就行了。
# 启动haproxy
/etc/init.d/haproxy start
# 停止haproxy
/etc/init.d/haproxy stop
# 如果你是 CentOS 7 系统,那么用这些命令:
# 启动haproxy
systemctl start haproxy.service
# 启动haproxy
systemctl stop haproxy.service
# Debian/Ubuntu 系统:
apt-get -y remove haproxy
# CentOS 系统:
yum -y remove haproxy
启动:/etc/init.d/haproxy start
停止:/etc/init.d/haproxy stop
重启:/etc/init.d/haproxy restart
重载:/etc/init.d/haproxy reload
状态:/etc/init.d/haproxy status
# 如果你是 CentOS 7 系统,那么用这些命令:
启动:systemctl start haproxy.service
停止:systemctl stop haproxy.service
重启:systemctl restart haproxy.service
状态:systemctl status haproxy.service