shadowsocks原版地址:https://github.com/shadowsocks/shadowsocks/releases

github下载源码包解压,进去目录里面的shadowsocks目录执行

./server.py -q -c /etc/shadowsocks.json

其中-q代表安静模式,这个模式下日志仅记录警告和错误,而不会记录访问日志,这样的好处是可以降低服务器压力,如果服务器还不错或者需要做日志统计,那么就不要加这个参数,-c后面的时候配置文件,下面的是配置文件内容

新建一个配置文件,运行命令vi /etc/shadowsocks.json内容如下

{
"server": "0.0.0.0",
"server_port": 4431,
"password": "pwd123",
"method": "aes-256-cfb",
"timeout": 200,
"workers": 1
}

备注:如要你需要分享SS服务给朋友或家人,可以配置多个SS账户,具体可以参考下面的代码。

{
"server": "0.0.0.0",
"port_password": {
"4431": "pwd123",
"4433": "pwd456",
"4433": "pwd789"
},
"local_address": "127.0.0.1",
"method": "aes-256-cfb",
"timeout": 200,
"workers": 1
}

备注:下面是可以使用的参数

{
"server": "0.0.0.0",
"server_ipv6": "::",
"server_port": 8388,
"local_address": "127.0.0.1",
"local_port": 1080,
"password": "mypassword",
"timeout": 200,
"method": "chacha20",
"protocol": "origin",
"protocol_param": "",
"obfs": "plain",
"obfs_param": "",
"redirect": "",
"dns_ipv6": false,
"fast_open": false,
"workers": 1
}

嫌每次启动麻烦可以将其加入自动启动,我使用的是supervisor,可以参考这里《Linux安装任务管理服务supervisor》,下面是supervisor中的配置参数

[supervisorctl]
[program:shadowsocks]
user = root
autostart = true
autorestart = true
startsecs = 10
stderr_logfile = /var/log/shadowsocks_err.log
stdout_logfile = /var/log/shadowsocks.log
command = python /var/www/html/shadowsocks-2.9.1/shadowsocks/server.py -q -c /etc/shadowsocks-aes.json

Last modification:November 30th, 2019 at 11:56 am