本文服务器操作系统CentOS7,文明上网使用v2ray,VPS购买流程这里不做介绍。
安装v2ray服务
- unzip包安装: yum install unzip -y
- v2ray服务安装: bash <(curl -L -s https://install.direct/go.sh)
- 按需配置: /etc/v2ray/config.json
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 
 | {"inbounds": [{
 "port": 9527,
 "protocol": "vmess",
 "settings": {
 "clients": [{
 "id": "********-****-****-****-************",
 "level": 1,
 "alterId": 64
 }]
 }
 }],
 "outbounds": [{
 "protocol": "freedom",
 "settings": {}
 }, {
 "protocol": "blackhole",
 "settings": {},
 "tag": "blocked"
 }],
 "routing": {
 "rules": [{
 "type": "field",
 "ip": ["geoip:private"],
 "outboundTag": "blocked"
 }]
 }
 }
 
 | 
- 启动服务: service v2ray start
- 开机启动项添加: /etc/rc.local 添加 service v2ray start
优化加速
| 12
 3
 4
 
 | # 优化加速脚本安装wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh
 chmod +x bbr.sh
 ./bbr.sh
 
 | 
端口防火墙配置
| 12
 3
 4
 5
 6
 
 | # 防火墙放通指定端口,允许公网访问firewall-cmd --zone=public --add-port=9527/tcp --permanent
 # 重启防火墙
 firewall-cmd --reload
 # 删除放通的端口
 firewall-cmd --zone=public --remove-port=9527/tcp --permanent
 
 | 
至此,服务端配置完成。