Rintarou°

CentOS 7丨ss-panel-v3-mod_Uim 后端配置及优化
ss-panel-v3-mod_Uim 后端配置及优化。
扫描右侧二维码阅读全文
05
2019/02

CentOS 7丨ss-panel-v3-mod_Uim 后端配置及优化

ss-panel-v3-mod_Uim 后端配置及优化。

Ⅰ、后端配置

安装libsodium以支持更多的加密方式

timedatectl set-timezone Asia/Shanghai
yum -y groupinstall "Development Tools"
yum -y install wget vim
wget https://github.com/jedisct1/libsodium/releases/download/1.0.16/libsodium-1.0.16.tar.gz
tar xf libsodium-1.0.16.tar.gz && cd libsodium-1.0.16
./configure && make -j2 && make install
echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

下载后端

yum -y install epel-release
yum -y install python-pip
git clone https://github.com/Anankke/shadowsocks-mod.git
cd shadowsocks
git reset --hard efc986b731164aae3fef6fb5b9e8802754e63e3e
pip install -r requirements.txt
cp apiconfig.py userapiconfig.py
cp config.json user-config.json

配合前端填写userapiconfig.py

vi userapiconfig.py

保存后启动后段测试是否可以运行:

python server.py

确定没问题后,结束,输入如下命令将程序放到后台运行:

./run.sh

Ⅱ、后端优化

1.修改句柄数限制


修改文件句柄限制

cat >> /etc/security/limits.conf << EOF
* soft nofile 51200
* hard nofile 51200
EOF

然后执行

ulimit -n 51200

优化内核参数

cat >> /etc/sysctl.conf << EOF
fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
EOF

然后

sysctl -p

2.开启BBR加速


使用root用户登录,运行以下命令:

wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh

Ⅲ、后端一键脚本

  • 可选配置节点为WebAPI模式或SQL模式
  • 可选配置单端口多用户
  • 可选启用BBR(from mainline kernel)
  • 可选注册为系统服务

1.安装

yum install wget -y && wget https://raw.githubusercontent.com/SuicidalCat/Airport-toolkit/master/ssr_node_c7.sh && chmod +x ssr_node_c7.sh && ./ssr_node_c7.sh

2.卸载

systemctl disable ssr_node && \rm /usr/lib/systemd/system/ssr_node.service && \rm -rf /soft/shadowsocks

3.设置开机启动

systemctl enable ssr_node

4.服务启动

systemctl start ssr_node

5.服务停止

systemctl stop ssr_node
Last modification:June 17th, 2019 at 09:02 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

One comment

  1. 无名

    厉害了博主

召唤看板娘