{"action":"created","issue":{"url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/471","labels_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/471/labels{/name}","comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/471/comments","events_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/471/events","html_url":"https://github.com/shadowsocks/shadowsocks/issues/471","id":119314208,"number":471,"title":"国内Haproxy中转教程","user":{"login":"bestony","id":13283837,"avatar_url":"https://avatars.githubusercontent.com/u/13283837?v=3","gravatar_id":"","url":"https://api.github.com/users/bestony","html_url":"https://github.com/bestony","followers_url":"https://api.github.com/users/bestony/followers","following_url":"https://api.github.com/users/bestony/following{/other_user}","gists_url":"https://api.github.com/users/bestony/gists{/gist_id}","starred_url":"https://api.github.com/users/bestony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestony/subscriptions","organizations_url":"https://api.github.com/users/bestony/orgs","repos_url":"https://api.github.com/users/bestony/repos","events_url":"https://api.github.com/users/bestony/events{/privacy}","received_events_url":"https://api.github.com/users/bestony/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-28T19:30:32Z","updated_at":"2015-12-01T07:59:21Z","closed_at":null,"body":"这里我们采用HaProxy来做转发工具\r\n首先安装HaProxy\r\nCentos使用\r\n```yum install haproxy```\r\nDebian使用\r\n```vi  /etc/apt/sources.list```\r\n添加如下内容\r\n```deb http://ftp.us.debian.org/debian/ wheezy-backports main```\r\n然后\r\n```apt-get update\r\napt-get install haproxy```\r\n接下来设置配置文件\r\n```vi /etc/haproxy/haproxy.cfg```\r\n清空配置文件后，输入如下内容\r\n```global\r\nulimit-n  51200\r\ndefaults\r\nlog global\r\nmode    tcp\r\noption  dontlognull\r\ntimeout connect 1000ms\r\ntimeout client 150000ms\r\ntimeout server 150000ms\r\nlisten status\r\nbind 0.0.0.0:1080\r\nmode http\r\nlog global\r\nstats refresh 30s\r\nstats uri /admin?stats\r\nstats realm Private lands\r\nstats auth admin:password\r\nstats hide-version\r\nfrontend ssin\r\nbind *:2000-3305\r\ndefault_backend ssout\r\nbackend ssout\r\nserver server1 SS服务器的IP maxconn 204800\r\n```\r\n将里面的SS的服务器的IP替换成你自己的SS服务器的IP即可\r\n其中的2000-3305为端口段，你可以改成你自己的端口段，我因为有mysql-server，所以3306无法被haproxy使用，只转发到了3305\r\n如果需要多服务器轮询的可以在backend里多建几个server轮询。\r\n保存退出后，\r\n执行\r\n```service haproxy restart```\r\n即可使用\r\n注意在防火墙中打开对应端口\r\nhttp://vpsug.com/threads/ss-manyuser.182/"},"comment":{"url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/comments/160887957","html_url":"https://github.com/shadowsocks/shadowsocks/issues/471#issuecomment-160887957","issue_url":"https://api.github.com/repos/shadowsocks/shadowsocks/issues/471","id":160887957,"user":{"login":"bestony","id":13283837,"avatar_url":"https://avatars.githubusercontent.com/u/13283837?v=3","gravatar_id":"","url":"https://api.github.com/users/bestony","html_url":"https://github.com/bestony","followers_url":"https://api.github.com/users/bestony/followers","following_url":"https://api.github.com/users/bestony/following{/other_user}","gists_url":"https://api.github.com/users/bestony/gists{/gist_id}","starred_url":"https://api.github.com/users/bestony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestony/subscriptions","organizations_url":"https://api.github.com/users/bestony/orgs","repos_url":"https://api.github.com/users/bestony/repos","events_url":"https://api.github.com/users/bestony/events{/privacy}","received_events_url":"https://api.github.com/users/bestony/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T07:59:21Z","updated_at":"2015-12-01T07:59:21Z","body":"喜欢的是他的负载均衡和监控。"}}