在vps上搭建ssr服务

这里是centos7为示例,介绍如何在 vps 上搭建 ssr 服务端。

服务器相关

建议购买香港服务器,配置不需要高,512m 都行,腾讯云活动还是挺优惠的~(不过要新用户)

安装最新内核并开启 BBR 脚本

参考资料

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

会重启vps

验证

1
sysctl net.ipv4.tcp_congestion_control

更新系统

epel-release 安装

1
yum install epel-release -y

更新系统:

1
yum update

安装一些软件

1
yum -y install wget vim

SSR

安装

1
2
3
4
5
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocksR.sh

chmod +x shadowsocksR.sh

./shadowsocksR.sh 2>&1 | tee shadowsocksR.log

按提示选择对应的

配置示例

1
2
3
4
5
6
7
Congratulations, ShadowsocksR server install completed!
Your Server IP : 47.56.170.229
Your Server Port : 18406
Your Password : teddysun.com
Your Protocol : auth_sha1_v4
Your obfs : tls1.2_ticket_auth
Your Encryption Method: aes-256-cfb

配置SSR

1
[root@host ~]# vim /etc/shadowsocks.json

协议和混淆插件说明

1
2
3
如不考虑原版的情况下,推荐使用的协议,只有auth_sha1_v4和auth_aes128_md5和auth_aes128_sha1和auth_chain_a,推荐使用的混淆只有plain,http_simple,http_post,tls1.2_ticket_auth

不要奇怪为什么推荐plain,因为混淆不总是有效果,要看各地区的策略的,有时候不混淆让其看起来像随机数据更好

单用户示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"server":"0.0.0.0",
"server_ipv6":"[::]",
"server_port":18406,
"local_address":"127.0.0.1",
"password": "teddysun.com",
"local_port":1080,
"timeout":120,
"method":"aes-256-cfb",
"protocol":"auth_sha1_v4",
"protocol_param":"",
"obfs":"tls1.2_ticket_auth",
"obfs_param":"",
"redirect":"",
"dns_ipv6":false,
"fast_open":false,
"workers":1
}

多用户配置示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"server":"0.0.0.0",
"server_ipv6":"[::]",
"local_address":"127.0.0.1",
"port_password": {
"18406": "ssr18406ssr!@#"
},
"local_port":1080,
"timeout":120,
"method":"aes-256-cfb",
"protocol":"auth_sha1_v4",
"protocol_param":"",
"obfs":"tls1.2_ticket_auth",
"obfs_param":"",
"redirect":"",
"dns_ipv6":false,
"fast_open":false,
"workers":1
}

使用命令

1
2
3
4
5
6
7
8
启动:/etc/init.d/shadowsocks start
停止:/etc/init.d/shadowsocks stop
重启:/etc/init.d/shadowsocks restart
状态:/etc/init.d/shadowsocks status

配置文件路径:/etc/shadowsocks.json
日志文件路径:/var/log/shadowsocks.log
代码安装目录:/usr/local/shadowsocks

卸载

1
./shadowsocksR.sh uninstall

参考资料

https://github.com/shadowsocksr-backup/shadowsocks-rss/wiki/Server-Setup
https://github.com/shadowsocksr-backup/shadowsocks-rss/blob/master/ssr.md
https://github.com/shadowsocksr-backup/shadowsocks-rss/wiki/config.json

ssr客户端下载

各个版本shadowsocks github

一些错误

配置了多用户后重启报以下错

1
2
3
4
5
[root@zhouhongfa ~]# /etc/init.d/shadowsocks restart
IPv6 not support
ERROR: found an error in config.json: Expecting property name: line 7 column 1 (char 133)
Stopping ShadowsocksR failed
ShadowsocksR (pid 26765) is already running...

解决:json格式问题~


0%
隐藏