手动部署sspanel后端

  • 建议在Debian9/10的环境下安装后端

1 安装

安装libsodium

wget -N --no-check-certificate https://raw.githubusercontent.com/aipeach/doubi/master/libsodium.sh && chmod +x libsodium.sh && bash libsodium.sh

Debian / Ubuntu:

apt update && apt install -y python3-pip libffi-dev libssl-dev git nano

下载后端源码

git clone -b manyuser https://github.com/Anankke/shadowsocks-mod.git /root/shadowsocks
cd shadowsocks

安装依赖

pip3 install -r requirements.txt

2 使用

创建配置文件

cp apiconfig.py userapiconfig.py
cp config.json user-config.json

修改配置

nano userapiconfig.py

运行后端

调试运行

python3 server.py

后台运行

./run.sh

3 配置 systemd

cp -r /root/shadowsocks/ssr.service /etc/systemd/system/

如需启动多个后端只需复制一份 ssr.service 改成不同文件名并修改 WorkingDirectory= 即可

多开后端

如下例

cp -r /root/shadowsocks /root/aipeach
cp -r /root/shadowsocks/ssr.service /etc/systemd/system/aipeach.service

启动程序并加入开机自启动

systemctl start ssr
systemctl enable ssr
echo "sshd: ALL" > /etc/hosts.allow
#防止 auto block 了自己无法连接 ssh

添加后端DNS解锁流媒体

echo -e "8.8.8.8\n" > /root/shadowsocks/dns.conf

填写DNS解锁的服务器IP即可解锁流媒体

userapiconfig.py各项配置信息

# Config
#面板对应的节点id
NODE_ID = 0
# hour,set 0 to disable
#测速默认6小时
SPEEDTEST = 6
#自动上报与下载封禁IP
CLOUDSAFE = 1
#自动封禁SS密码和加密方式错误的 IP
ANTISSATTACK = 0
#是否接受上级下发的命令
AUTOEXEC = 0

#单端口多用户混淆参数后缀,可以随意修改,但请保持前后端一致
MU_SUFFIX = 'zhaoj.in'
#单端口多用户混淆参数表达式
MU_REGEX = '%5m%id.%suffix'

SERVER_PUB_ADDR = '127.0.0.1'  # mujson_mgr need this to generate ssr link
#对接方式,glzjinmod (数据库方式连接),modwebapi (webapi)
API_INTERFACE = 'modwebapi'  # glzjinmod, modwebapi
# 面板站点地址,如果开启了 https 需要修改为https
WEBAPI_URL = 'https://zhaoj.in'
# .config.php里设置的对接口令
WEBAPI_TOKEN = 'glzjin'

# mudb
MUDB_FILE = 'mudb.json'

# Mysql
MYSQL_HOST = '127.0.0.1'
MYSQL_PORT = 3306
MYSQL_USER = 'ss'
MYSQL_PASS = 'ss'
MYSQL_DB = 'shadowsocks'

MYSQL_SSL_ENABLE = 0
MYSQL_SSL_CA = ''
MYSQL_SSL_CERT = ''
MYSQL_SSL_KEY = ''

# API
API_HOST = '127.0.0.1'
API_PORT = 80
API_PATH = '/mu/v2/'
API_TOKEN = 'abcdef'
API_UPDATE_TIME = 60

# Manager (ignore this)
MANAGE_PASS = 'ss233333333'
# if you want manage in other server you should set this value to global ip
MANAGE_BIND_IP = '127.0.0.1'
# make sure this port is idle
MANAGE_PORT = 23333

最后更新于