shadowsocks服务器和苹果MacOS客户端教程
shadowsocks服务器和苹果MacOS客户端教程
I 推荐Linode作为VPS供应商
II 安装shadowsocks 服务器端
Ubuntu
apt-get install python-pip
pip install shadowsocks
III shadowsocks配置文件
在/etc目录下创建shadowsocks.json文件
{
"server":"my_server_ip", #服务器 IP (IPv4/IPv6),注意这也将是服务端监听的 IP 地址
"server_port":8388, #服务器端口
"local_port":1080, #本地端端口
"password":"barfoo!", #用来加密的密码
"timeout":600, #超时时间(秒)
"method":"aes-256-cfb" #加密方法,可选择 "bf-cfb", "aes-256-cfb", "des-cfb", "rc4", 等等
}
VI 运行ShadowSocks程序
启动shadowsocks,使用ssserver命令运行,具体用法如下:
usage:
ss-[local|redir|server|tunnel]
-s <server_host> host name or ip address of your remote server
-p <server_port> port number of your remote server
-l <local_port> port number of your local server
-k <password> password of your remote server
[-m <encrypt_method>] encrypt method: table, rc4, rc4-md5
aes-128-cfb, aes-192-cfb, aes-256-cfb,
bf-cfb, camellia-128-cfb, camellia-192-cfb,
camellia-256-cfb, cast5-cfb, des-cfb,
idea-cfb, rc2-cfb and seed-cfb
[-f <pid_file>] file to store the pid
[-t <timeout>] socket timeout in seconds
[-c <config_file>] config file in json
[-i <interface>] network interface to bind,
not available in redir mode
[-b <local_address>] local address to bind,
not available in server mode
[-u] enable udprelay mode
not available in redir mode
[-L <addr>:<port>] setup a local port forwarding tunnel,
only available in tunnel mode
[-v] verbose mode
[--fast-open] enable TCP fast open,
only available on Linux kernel > 3.7.0
[--acl <acl_file>] config file of ACL (Access Control List)
ss-redir provides a transparent proxy function and only works on the
Linux platform with iptables.
启动命令ssserver -c /etc/shadowsocks.json
V 后台运行
安装使用supervisor
apt-get update
apt-get install python-pip python-m2crypto supervisor
pip install shadowsocks
编辑 /etc/supervisor/conf.d/shadowsocks.conf ,增加下面的内容:
[program:shadowsocks]
command=ssserver -c /etc/shadowsocks.json
autorestart=true
user=nobody
并在 /etc/default/supervisor 文件的后面加入下面的一行内容:
ulimit -n 51200
接着运行命令,启动supervisor:
service supervisor start
supervisorctl reload
现在supervisor启动了
supervisorctl tail -f shadowsocks stderr //查看shadowsocks日志
supervisorctl restart shadowsocks //重启shadowsocks进程
supervisorctl start shadowsocks //启动shadowsocks进程
supervisorctl stop shadowsocks //停止shadowsocks进程