个人VPS代理服务器及家宽配置全面指南

请确保已通过 FinalShell 以 root 用户身份连接至 Debian 12 服务器。

阶段一:环境清理与网络准备

步骤 1:放行防火墙端口

  • 操作风险等级: 高风险(必须严格按顺序执行,确保 SSH 端口开放)
  • 操作方式: 依次执行以下命令,确保 SSH(22)及 Web/代理端口畅通。
1
2
3
4
5
6
7
8
9
10
11
12
13
apt update
apt install ufw -y

# 【极其重要】必须首先放行 SSH 端口,否则防火墙启动后将无法连接服务器!
ufw allow ssh

# 放行证书申请与 Hysteria 2 代理端口
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 443/udp

# 启用防火墙(如果提示 "Command may disrupt existing ssh connections...",输入 y 并回车)
ufw enable

阶段二:Hysteria 2 服务端部署

步骤 1:执行官方安装脚本

  • 操作风险等级: 低风险
  • 操作方式: 执行以下命令,等待提示 Installed successfully。
1
2
bash <(curl -fsSL https://get.hy2.sh/)

步骤 2:配置服务端核心文件

  • 操作风险等级: 高风险(YAML 格式对缩进极其敏感,多或少一个空格均会导致程序崩溃)
  • 文件路径: /etc/hysteria/config.yaml
  • 文本编码要求: UTF-8
  • 操作方式: 在 FinalShell 下方的文件管理器中找到该文件并双击打开,清空原内容,将以下代码粘贴进去。必须修改双引号内的值。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
listen: :443

acme:
domains:
- "your_domain.com"
email: "your_email@example.com"

auth:
type: password
password: "your_secure_password"

# 新增:HTTP/3 网页伪装(防封锁核心机制)
masquerade:
type: proxy
proxy:
url: https://bing.com/
rewriteHost: true
  • 替换说明:
    • “your_domain.com”:替换为已解析至该 VPS IP 的真实域名(保留双引号)。
    • your_email@example.com“:替换为随机的邮箱地址(保留双引号)。
    • “your_secure_password”:替换为自定义的复杂连接密码(保留双引号)。

步骤 3:启动并设置开机自启

  • 操作风险等级: 低风险
  • 操作方式: 依次执行以下命令。
1
2
3
systemctl start hysteria-server.service
systemctl enable hysteria-server.service
systemctl status hysteria-server.service
  • 验证标准:最后一条命令执行后,输出结果中必须包含绿色的 active (running) 字样。按 q可退出状态查看。

阶段三:客户端(Clash Verge Rev)配置代理链

此处不再操作服务器,所有配置均在本地 Windows 电脑的 Clash Verge Rev 软件中完成。
步骤 1:编写本地 YAML 配置文件

  • 操作风险等级: 高风险(需严格遵守 YAML 缩进规范)
  • 文本编码要求: UTF-8
  • 操作方式: 在 Clash Verge Rev 软件中,点击“配置” -> “新建” -> 类型选择“本地”。在文本框中粘贴以下代码。
1
2
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mode: rule
log-level: info
allow-lan: true
dns:
enable: true
ipv6: false
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver:
- 223.5.5.5
- 114.114.114.114
fallback:
- 8.8.8.8
- 1.1.1.1

proxies:
- name: "VPS-Direct"
type: hysteria2
server: "your_domain.com"
port: 443
password: "your_secure_password"
sni: "your_domain.com"
skip-cert-verify: false

- name: "WebShare-HomeIP"
type: socks5
server: "proxy_address.webshare.io"
port: 1080
username: "webshare_username"
password: "webshare_password"
dialer-proxy: "VPS-Direct"
proxy-groups:
- name: "Proxy"
type: select
proxies:
- "VPS-Direct"
- "WebShare-HomeIP"

rules:
- GEOIP,lan,DIRECT,no-resolve
- GEOSITE,cn,DIRECT
- GEOIP,cn,DIRECT
- MATCH,Proxy
  • 替换说明:
    • “your_domain.com” (共两处):替换为服务端配置中使用的域名(保留双引号)。
    • “your_secure_password”:替换为服务端配置中设置的密码(保留双引号)。
    • “proxy_address.webshare.io”:替换为 WebShare 提供的代理服务器地址或 IP(保留双引号)。
    • 1080:替换为 WebShare 提供的具体端口号(纯数字,无双引号)。
    • “webshare_username”:替换为 WebShare 提供的代理认证用户名(保留双引号)。
    • “webshare_password”:替换为 WebShare 提供的代理认证密码(保留双引号)。

步骤 2:激活并验证

  1. 点击右上角保存该配置。
  2. 在配置列表中右键点击该配置,选择“使用”。
  3. 开启 Clash Verge Rev 的“系统代理”开关。
  4. 进入软件的“代理”界面,在 Proxy 策略组中,即可通过鼠标点击在 VPS-Direct(仅使用 VPS)和 WebShare-HomeIP(通过 VPS 转发至代理 IP)之间进行无缝切换。

个人VPS代理服务器及家宽配置全面指南
https://lvlele.top/211个人VPS代理服务器及家宽配置全面指南/
作者
吕了了
发布于
2026年6月24日
许可协议