2017年4月17日星期一

shadowsocksr ssr 服务端配置 supervisor配置

yum install python-setuptools && easy_install pip
yum install git
ubuntu/debian:
apt-get install python-pip
apt-get install git
获取源代码
执行完毕后此目录会新建一个shadowsocks目录,其中根目录的是多用户版(即数据库版),子目录中的是单用户版。
根目录即 ./shadowsocks
子目录即 ./shadowsocks/shadowsocks
服务端配置
进入根目录初始化配置(假设根目录在~/shadowsocks,如果不是,命令需要适当调整):
cd ~/shadowsocks
bash initcfg.sh
shadowsocks目录内,对userapiconfig.py里以下内容进行相应修改:
API_INTERFACE = 'mudbjson' //修改接口类型
接着,通过使用脚本mujson_mgr.py添加端口及相应的加密、协议、混淆等配置,具体方法通过执行以下命令查看该脚本的说明及提示:
python mujson_mgr.py
使用配置文件运行
如果你的ss目录是~/shadowsocks,进入这里
修改user-config.json中的server_port,password等字段,具体可参见:
https://github.com/breakwa11/shadowsocks-rss/wiki/config.json
安装libsodium
如果要使用 salsa20 或 chacha20 或 chacha20-ietf 算法,请安装 libsodium
apt-get install build-essential
wget https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz
tar xf libsodium-1.0.10.tar.gz && cd libsodium-1.0.10
./configure && make -j2 && make install
ldconfig
user-config.json 单用户配置示例:
{
    "server":"0.0.0.0",
    "server_ipv6": "[::]",
    "local_address":"127.0.0.1",
    "local_port":1080,
    "port_password":{
        "8080":{"protocol":"auth_sha1", "password":"mima", "obfs":"http_simple", "obfs_param":""},
        "443":{"password":"mima"}
    },
    "timeout":300,
    "method":"chacha20-ietf",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",
    "redirect": "apeggplfc4e.com:443",
    "dns_ipv6": true,
    "fast_open": false,
    "workers": 5
}
更新源代码
如果代码有更新可用本命令更新代码
进入shadowsocks目录
cd shadowsocks
执行
git pull
成功后重启ss服务
---------------------
supervisor 配置后台运行
supervisord.conf配置示例
; supervisor config file

[unix_http_server]
file=/var/run//supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run//supervisor.sock ; use a unix:// URL  for a unix socket
serverurl=http://0.0.0.0:9001 ; use an http:// url to specify an inet socket
username=jun
password=junsheng

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

[include]
files = /etc/supervisor/conf.d/*.conf
# 如需要访问web控制界面,inet_http_server 区段修改为:
[inet_http_server]
port=0.0.0.0:9001
username=用户名
password=密码
shadowsocksr.conf配置示例
[program:shadowsocksr]
command=/usr/bin/python /shadowsocks/shadowsocks/server.py -c /shadowsocks/shadowsocks/user-config.json
autorestart=true
autostart=true
stderr_logfile=/var/log/ssrserver.err.log
stderr_logfile_maxbytes=1MB
stdout_logfile=/var/log/ssrserver.out.log
stdout_logfile_maxbytes=1MB
user=root

没有评论:

发表评论