云服为 Ubuntu 系统
本文中的云服务器指崭新的、尚未安装系统或仅安装基础系统的云服务器。如果你已经在服务器上部署了其他内容,请如实告知 AI,并将本教程一并复制给 AI,按照 AI 提供的方案操作。
请注意备份,本文中可能包含部分破坏性内容,请务必甄别。本文不作任何担保。
首先,你需要拥有一台云服务器,且必须是独享公网 IPv4 地址,不能是共享 IPv4,也不能是 IPv6。
然后,你需要在云服务器上安装 Ubuntu 22.04。
🔐 安装完成后,立刻做三件事
Section titled “🔐 安装完成后,立刻做三件事”1. SSH 登录
Section titled “1. SSH 登录”用你电脑的终端或 PowerShell 执行:
ssh root@你的云服务器 IP可能会有如下提示:
The authenticity of host '103.217.186.229 (103.217.186.229)' can't be established.ED25519 key fingerprint is SHA256:ramCLPEW/tKTwpDJREvRQXitVeMiVEtX+GQEiFgdENI.This host key is known by the following other names/addresses: C:\Users\Administrator/.ssh/known_hosts:5: 103.217.186.86Are you sure you want to continue connecting (yes/no/[fingerprint])?无特殊要求输入 yes 即可。
然后输入刚才设置的 root 密码。输入时不会显示密码,也就是说你无论输入什么都不会显示在屏幕上,只需回车确认。这是安全策略,并非输入无效。
2. 更新系统
Section titled “2. 更新系统”执行以下命令:
apt update && apt upgrade -y更新时如果遇到不确定的问题,请先咨询 AI,不要自行决定。
更新服务器中经常出现的 Y/N 选择
情况一:配置文件冲突
Section titled “情况一:配置文件冲突”更新过程中可能出现如下提示:
Configuring openssh-server--------------------------
A new version (/tmp/tmp.c3JCZOqVY5) of configuration file /etc/ssh/sshd_config is available, but the version installedcurrently has been locally modified.
1. install the package maintainer's version 5. show a 3-way difference between available versions 2. keep the local version currently installed 6. do a 3-way merge between available versions 3. show the differences between the versions 7. start a new shell to examine the situation 4. show a side-by-side difference between the versionsWhat do you want to do about modified configuration file sshd_config?这是系统更新时发现 SSH 配置文件被修改过,询问如何处理。请选择 2(保留本地版本),这样不会改乱你当前的 SSH 设置,保证不会突然断连。
情况二:内核更新与服务重启
Section titled “情况二:内核更新与服务重启”更新过程中还可能出现:
----------------------
Newer kernel available
The currently running kernel version is 5.15.0-118-generic which is not the expected kernel version 5.15.0-185-generic.
Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting.
Restarting services...Daemons using outdated libraries--------------------------------
1. dbus.service 3. multipathd.service 5. systemd-logind.service 7. user@0.service 2. getty@tty1.service 4. networkd-dispatcher.service 6. unattended-upgrades.service 8. none of the above
(Enter the items or ranges you want to select, separated by spaces.)
Which services should be restarted?输入 1 2 3 4 5 6 7,然后按回车。
这会重启所有需要更新的服务,确保系统组件都是最新版本,避免后续搭建代理时出现兼容性问题。重启完成后,就可以继续执行安装 HTTP 代理的命令了。
3. 放行端口
Section titled “3. 放行端口”免费或其他云服务器通常没有独立的安全组/防火墙面板。你可以先用 SSH 连接测试一下,如果 ssh root@你云服务器的公网 IP 能连通,说明默认所有端口都是放行的,这是最好的情况。
在云服务商面板的“安全组/防火墙”中添加以下规则:
TCP 22(SSH)TCP 8888(SOCKS5/HTTP 代理端口,以你的喜好为准。默认为 8888,以下示范使用 8888)TCP 7000(FRP 服务端)TCP 5123(服务端口,按需修改)UDP 5123(服务端游戏 UDP,与 TCP 端口一致)搭建 HTTP 代理
Section titled “搭建 HTTP 代理”系统已经更新完毕,环境干净,现在可以继续搭建 HTTP 代理。
1. 安装并配置 Tinyproxy(HTTP 代理)
Section titled “1. 安装并配置 Tinyproxy(HTTP 代理)”需要放行的端口:
5123:保留(官方自检会访问你的 5123 端口,即你的 RW-HPS 服务端游戏端口)80:HTTP 标准端口(官方列表接口 http://gs1.corrodinggames.com 用的是 80 端口)443:HTTPS 标准端口
执行以下命令安装 Tinyproxy:
apt install tinyproxy -y写入配置文件:
cat > /etc/tinyproxy/tinyproxy.conf << 'EOF'Port 8888Listen 0.0.0.0Timeout 600Allow 0.0.0.0/0ConnectPort 80ConnectPort 443ConnectPort 5123ViaProxyName "tinyproxy"EOF配置文件重要字段含义
Port:8888 代表代理监听 8888 端口,在配置文件中的 代理端口(proxy_port) 也要填写 8888,如果修改防火墙也要变。
Listen:0.0.0.0 代表全公网监听,不要填写 127.0.0.1 或其他内网地址!
停止旧进程并启动新配置:
pkill -9 tinyproxytinyproxy -c /etc/tinyproxy/tinyproxy.conf检查代理是否运行:
ss -tlnp | grep 8888 # 应显示 LISTEN恭喜你完成代理搭建!现在进行下一步。
启动 FRP 服务端(映射 RW-HPS 端口到云服)
Section titled “启动 FRP 服务端(映射 RW-HPS 端口到云服)”一、云服务器端(Ubuntu)—— 安装 FRP 服务端
Section titled “一、云服务器端(Ubuntu)—— 安装 FRP 服务端”1. 下载 FRP
Section titled “1. 下载 FRP”下载慢是正常现象,如果非常慢或超时,可以去 Bing 搜索 GitHub 镜像站,使用专用于下载 Release、压缩包的镜像链接。
例如将
https://github.com/fatedier/frp/releases/download/v0.57.0/frp_0.57.0_linux_amd64.tar.gz复制并转换链接,即可得到加速拉取链接。
替换原有链接。
wget <加速拉取链接>
wget https://github.com/fatedier/frp/releases/download/v0.57.0/frp_0.57.0_linux_amd64.tar.gz此步骤如果报错(例如文件不完整等),请直接带着日志咨询 AI。
tar -zxvf frp_0.57.0_linux_amd64.tar.gzcd frp_0.57.0_linux_amd643. 修改 frps.ini 与 frps.toml
Section titled “3. 修改 frps.ini 与 frps.toml”cd ~/frp_0.57.0_linux_amd64写入 frps.ini:
cat > frps.ini << 'EOF'bindPort = 7000auth.token = "你自己编一个复杂的密码,比如 x8Fk2Lp9qR5tY"EOF写入 frps.toml:
cat > frps.toml << 'EOF'bindPort = 7000auth.token = "你自己编一个复杂的密码,比如 x8Fk2Lp9qR5tY"EOF4. 停掉所有 FRP 进程
Section titled “4. 停掉所有 FRP 进程”pkill frps确认端口已释放:
ss -tlnp | grep 7000如果没有任何输出,表示端口已释放。
重新启动 FRP 前,确保 frps.ini 内容正确(包含 token):
cat frps.ini应显示类似内容:
bindPort = 7000auth.token = "你自己编一个复杂的密码,比如 x8Fk2Lp9qR5tY"5. 启动 FRP 服务端(后台运行)
Section titled “5. 启动 FRP 服务端(后台运行)”nohup ./frps -c frps.ini > frps.log 2>&1 &6. 检查是否成功
Section titled “6. 检查是否成功”ss -tlnp | grep 7000看到 LISTEN 0 128 ... :::7000 就说明服务端已运行。
看到监听 7000 就说明成功。
二、本地 Windows 电脑 —— 配置 FRP 客户端
Section titled “二、本地 Windows 电脑 —— 配置 FRP 客户端”1. 下载 FRP Windows 版
Section titled “1. 下载 FRP Windows 版”打开浏览器访问:
https://github.com/fatedier/frp/releases/download/v0.57.0/frp_0.57.0_windows_amd64.zip
下载并解压到任意文件夹(例如 C:\frpc)。
2. 创建 frpc.ini
Section titled “2. 创建 frpc.ini”在本地 Windows 电脑创建 frpc.ini,注意 auth.token 与云服务器上设置的密码一致。实际书写时,下面示例中的注释 # 和云服务器上的 token (密码) 一致 要删除。
serverAddr = "云端公网ip"serverPort = 7000auth.token = "x8Fk2Lp9qR5tY" # 和云服务器上的 token (密码) 一致
[[proxies]]name = "rusted_warfare_tcp"type = "tcp"localIP = "127.0.0.1"localPort = 5123remotePort = 5123
[[proxies]]name = "rusted_warfare_udp"type = "udp"localIP = "127.0.0.1"localPort = 5123remotePort = 51233. 启动 FRP 客户端
Section titled “3. 启动 FRP 客户端”在 FRP 所在文件夹的地址栏输入 cmd 回车,然后运行:
frpc.exe如果看到 [proxy] [rusted_warfare_tcp] start proxy success 和 [rusted_warfare_udp] start proxy success,说明连接成功。
请进入 pluginstart.md。
现在云服务器以及本地 FRP 已经全部设置完成
Section titled “现在云服务器以及本地 FRP 已经全部设置完成”让我们回到插件,请转到本仓库中的 pluginstart.md。
你可能已经知道 SOCKS/HTTP 代理没有防护措施,这意味着任何知道你 IP 的人都能直接使用这个 SOCKS/HTTP 代理。这句话是正确的,但实测时故障较多。故本文中安全方面基本没有涉及,如果你需要安全方面的问题,请复制本文并与 AI 沟通。
FRP 有密钥基本不怕,但如果你有需求,请一并与 AI 沟通。
🚀 云服务器开机后操作步骤(安装向导走完以后用这个步骤)
Section titled “🚀 云服务器开机后操作步骤(安装向导走完以后用这个步骤)”- SSH 登录
ssh root@103.999.465.13- 启动 SOCKS5/HTTP 代理(tinyproxy)
tinyproxy -c /etc/tinyproxy/tinyproxy.conf检查是否成功:
ss -tlnp | grep 8888看到 LISTEN 说明代理已运行。
- 启动 FRP 服务端
cd ~/frp_0.57.0_linux_amd64nohup ./frps -c frps.toml > frps.log 2>&1 &检查:
ss -tlnp | grep 7000看到 LISTEN 说明 FRP 服务端已运行。
🚀 服务端所在主机开机后操作步骤(再次使用走这个步骤)
Section titled “🚀 服务端所在主机开机后操作步骤(再次使用走这个步骤)”在 FRP 根文件夹的地址栏输入 cmd 回车,然后运行:
frpc如果看到 [proxy] [rusted_warfare_tcp] start proxy success 和 [rusted_warfare_udp] start proxy success,说明连接成功。