Updated 用 Supervisor 运行 Shadowsocks (markdown)
parent
5d3894c6cb
commit
0cb5f18455
1 changed files with 42 additions and 29 deletions
|
@ -1,20 +1,9 @@
|
||||||
如果你想在后台运行 Shadowsocks,可以使用 Supervisor,
|
如果你想在后台运行 Shadowsocks,可以使用 Supervisor,
|
||||||
它可以方便地监控和控制任何程序,实现开机自动启动和后台运行。
|
它可以方便地监控和控制任何程序,实现开机自动启动和后台运行。
|
||||||
|
|
||||||
下面是 Debian 和 Ubuntu 上的配置方法(如果你是 Linux 新手,
|
编辑 `/etc/shadowsocks.json`
|
||||||
不需要 [SELinux],也不了解[防火墙配置],也弄不清楚 RHEL 和
|
|
||||||
CentOS 的[版本机制],那就用 Debian 或 Ubuntu 吧,别折腾了):
|
|
||||||
|
|
||||||
1. 执行
|
|
||||||
```
|
|
||||||
apt-get update
|
|
||||||
apt-get install python-pip python-m2crypto supervisor
|
|
||||||
pip install shadowsocks
|
|
||||||
```
|
|
||||||
|
|
||||||
2. 编辑 `/etc/shadowsocks.json`
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
{
|
||||||
"server":"0.0.0.0",
|
"server":"0.0.0.0",
|
||||||
"server_port":7325,
|
"server_port":7325,
|
||||||
|
@ -23,37 +12,42 @@ CentOS 的[版本机制],那就用 Debian 或 Ubuntu 吧,别折腾了):
|
||||||
"timeout":600,
|
"timeout":600,
|
||||||
"method":"aes-256-cfb"
|
"method":"aes-256-cfb"
|
||||||
}
|
}
|
||||||
```
|
|
||||||
记得改密码和服务端端口,不要用默认的。
|
|
||||||
|
|
||||||
3. 编辑 `/etc/supervisor/conf.d/shadowsocks.conf`
|
记得改密码和服务端端口,不要用默认的。
|
||||||
|
|
||||||
|
Debian
|
||||||
|
------
|
||||||
|
|
||||||
|
执行
|
||||||
|
|
||||||
|
apt-get update
|
||||||
|
apt-get install python-pip python-m2crypto supervisor
|
||||||
|
pip install shadowsocks
|
||||||
|
|
||||||
|
|
||||||
|
编辑 `/etc/supervisor/conf.d/shadowsocks.conf`
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
[program:shadowsocks]
|
[program:shadowsocks]
|
||||||
command=ssserver -c /etc/shadowsocks.json
|
command=ssserver -c /etc/shadowsocks.json
|
||||||
autorestart=true
|
autorestart=true
|
||||||
user=nobody
|
user=nobody
|
||||||
```
|
|
||||||
如果端口 < 1024,把上面的 user=nobody 改成 user=root。
|
|
||||||
|
|
||||||
4. 在 `/etc/default/supervisor` 最后加一行:
|
如果端口 < 1024,把上面的 user=nobody 改成 user=root。
|
||||||
|
|
||||||
|
在 `/etc/default/supervisor` 最后加一行:
|
||||||
|
|
||||||
```
|
|
||||||
ulimit -n 51200
|
ulimit -n 51200
|
||||||
```
|
|
||||||
|
|
||||||
5. 执行
|
执行
|
||||||
```
|
|
||||||
service supervisor start
|
service supervisor start
|
||||||
supervisorctl reload
|
supervisorctl reload
|
||||||
```
|
|
||||||
就好了。
|
|
||||||
|
|
||||||
如果遇到问题,可以检查日志:
|
如果遇到问题,可以检查日志:
|
||||||
|
|
||||||
supervisorctl tail -f shadowsocks stderr
|
supervisorctl tail -f shadowsocks stderr
|
||||||
|
|
||||||
|
|
||||||
如果修改了 shadowsocks 配置 `/etc/shadowsocks.json`,
|
如果修改了 shadowsocks 配置 `/etc/shadowsocks.json`,
|
||||||
可以重启 shadowsocks:
|
可以重启 shadowsocks:
|
||||||
|
|
||||||
|
@ -64,6 +58,25 @@ CentOS 的[版本机制],那就用 Debian 或 Ubuntu 吧,别折腾了):
|
||||||
|
|
||||||
supervisorctl update
|
supervisorctl update
|
||||||
|
|
||||||
[SELinux]: http://wiki.centos.org/HowTos/SELinux
|
CentOS
|
||||||
[防火墙配置]: https://github.com/clowwindy/shadowsocks/issues/133
|
------
|
||||||
[版本机制]: http://wiki.centos.org/FAQ/General#head-6e2c3746ec45ac3142917466760321e868f43c0e
|
|
||||||
|
编辑 `/etc/supervisord.conf`, 添加
|
||||||
|
|
||||||
|
```
|
||||||
|
[program:shadowsocks]
|
||||||
|
command=ssserver -c /etc/shadowsocks.json
|
||||||
|
autorestart=true
|
||||||
|
user=nobody
|
||||||
|
```
|
||||||
|
|
||||||
|
运行
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo yum install python-pip supervisor
|
||||||
|
sudo pip install shadowsocks
|
||||||
|
sudo chkconfig --add supervisord
|
||||||
|
sudo chkconfig supervisord on
|
||||||
|
service supervisor start
|
||||||
|
supervisorctl reload
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue