安装
1 2 3
| yum update -y yum install python-pip m2crypto supervisor -y pip install shadowsocks
|
配置
1
| vi /etc/ss/shadowsocks.json
|
单端口:
1 2 3 4 5 6 7
| { "server": "0.0.0.0", "server_port": 8388, "password": "password", "timeout": 600, "method": "aes-256-cfb" }
|
多端口:
1 2 3 4 5 6 7 8 9 10 11 12
| { "server": "0.0.0.0", "local_address": "127.0.0.1", "local_port": 1080, "port_password": { "443": "443", "8888": "8888" }, "timeout": 300, "method": "aes-256-cfb", "fast_open": false }
|
- 配置说明 | Name Explanation:
键 |
缺省值 |
解释 |
备注 |
server |
“0.0.0.0” |
the address your server listens |
服务器IP |
server_port |
8388 |
server port |
服务器端口 |
local_address |
“127.0.0.1” |
the address your local listens |
本地代理地址 |
local_port |
1080 |
local port |
本地代理端口 |
password |
|
password used for encryption |
服务器端口和密码 |
timeout |
300 |
in seconds |
超时断开,以秒为单位 |
method |
“aes-256-cfb” |
Encryption method, see Encryption |
加密方式 |
fast_open |
false |
use TCP_FASTOPEN, true / false |
是否使用TCP |
workers |
|
number of workers, available on Unix/Linux |
可不设置 |
- AttributeError: /lib/x86_64-linux-gnu/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup 的解决办法:
1
| vi /usr/local/lib/python3.9/dist-packages/shadowsocks/crypto/openssl.py
|
启动
To run in the foreground:
1
| ssserver -c /etc/ss/shadowsocks.json
|
To run in the background:
1 2
| ssserver -c /etc/ss/shadowsocks.json -d start ssserver -c /etc/ss/shadowsocks.json -d stop
|
To run as service:
1 2 3 4 5 6 7 8 9 10 11
| echo " [Unit] Description=*** [Service] TimeoutStartSec=0 ExecStart=/usr/bin/ssserver -c /etc/ss/shadowsocks.json [Install] WantedBy=multi-user.target " >> /etc/systemd/system/shadowsocks.service
systemctl start shadowsocks.service && systemctl enable shadowsocks.service
|
配置 supervisor
1 2 3
| pip install supervisor echo_supervisord_conf > /etc/supervisord.conf vi /etc/supervisord.conf
|
1 2 3 4
| [program:shadowsocks] command=ssserver -c /etc/ss/shadowsocks.json autorestart=true user=nobody
|
参考资料