2025-06-12
VPS
00
请注意,本文编写于 182 天前,最后修改于 180 天前,其中某些信息可能已经过时。

目录

A 和 B 服务器 GOST 代理链部署文档(精简版)
1. acme.sh 证书申请(standalone 模式)
2. GOST 一键安装脚本
3. GOST 服务配置示例
B服务器(出口)systemd 服务文件 /etc/systemd/system/gost-server.service
A服务器(入口)systemd 服务文件 /etc/systemd/system/gost-client.service
4. logrotate 日志轮转配置
5. 常用排查问题指令
6. 总结

文档通过perplexity总结,包括 acme.sh 使用 standalone 模式申请证书GOST 一键安装脚本域名动态替换说明,以及常用排查问题指令


A 和 B 服务器 GOST 代理链部署文档(精简版)

1. acme.sh 证书申请(standalone 模式)

  1. 安装 acme.sh
bash
curl https://get.acme.sh | sh source ~/.bashrc
  1. 安装 socat(standalone 模式需要)
bash
sudo apt install socat
  1. 申请证书
bash
acme.sh --issue --standalone -d <你的域名> -d <你的其他域名(可选)>
  • 请将 <你的域名> 替换为实际域名
  • standalone 模式要求 80/443 端口未被占用
  1. 安装证书
bash
mkdir -p /etc/ssl/ acme.sh --install-cert -d <你的域名> \ --key-file /etc/ssl/<你的域名>.key \ --fullchain-file /etc/ssl/<你的域名>.crt \ --reloadcmd "systemctl reload gost-server"

2. GOST 一键安装脚本

bash
bash <(curl -fsSL https://github.com/go-gost/gost/raw/master/install.sh) --install
  • 安装完成后,GOST 二进制文件位于 /usr/local/bin/gost123
  • 根据实际情况替换配置文件中的域名和证书路径。

3. GOST 服务配置示例

B服务器(出口)systemd 服务文件 /etc/systemd/system/gost-server.service

ini
[Unit] Description=GOST Proxy Server (WSS Relay) After=network.target [Service] Type=simple User=nobody ExecStart=/usr/local/bin/gost -L "relay+wss://<用户名>:<密码>@[::]:8443?path=/video&certFile=/etc/ssl/<你的域名>.crt&keyFile=/etc/ssl/<你的域名>.key&proxyProtocol=1" -L "socks5://127.0.0.1:1080?udp=true" Restart=always RestartSec=5s LimitNOFILE=4096 StandardOutput=append:/var/log/gost-server.log StandardError=append:/var/log/gost-server.log [Install] WantedBy=multi-user.target
  • 请将 <用户名>:<密码><你的域名> 替换为实际值。

A服务器(入口)systemd 服务文件 /etc/systemd/system/gost-client.service

ini
[Unit] Description=GOST Proxy Client (SOCKS5 over WSS) After=network.target [Service] Type=simple User=nobody ExecStart=/usr/local/bin/gost -L "socks5://<用户名>:<密码>@[::]:10088?udp=true" -F "relay+wss://<用户名>:<密码>@[B的IPv6]:8443?path=/video&host=<你的域名>&serverName=<你的域名>&secure=true" Restart=always RestartSec=5s LimitNOFILE=4096 StandardOutput=append:/var/log/gost-client.log StandardError=append:/var/log/gost-client.log [Install] WantedBy=multi-user.target
  • 请将 <用户名>:<密码><你的域名>[B的IPv6] 替换为实际值。

4. logrotate 日志轮转配置

conf
/var/log/gost-server.log { daily rotate 7 compress missingok notifempty copytruncate }
  • A服务器同理,路径为 /var/log/gost-client.log

5. 常用排查问题指令

指令用途
journalctl -u gost-server -f查看 GOST 服务实时日志
journalctl -u gost-client -f查看 GOST 客户端实时日志
sudo systemctl status gost-server查看服务状态
sudo systemctl status gost-client查看客户端状态
sudo lsof -i :8443检查 8443 端口占用
sudo lsof -i :1080检查 1080 端口占用
curl -v -x socks5h://<用户名>:<密码>@[::1]:10088 https://ifconfig.me测试 SOCKS5 代理
sudo logrotate -f /etc/logrotate.d/gost-server手动轮转日志
sudo tail -f /var/log/gost-server.log查看日志文件
ls -l /etc/ssl/<你的域名>.key检查证书权限
sudo chmod 644 /etc/ssl/<你的域名>.key调整证书权限

6. 总结

  • acme.sh 使用 standalone 模式申请证书,需安装 socat。
  • GOST 可使用官方一键安装脚本安装。
  • 配置文件中的域名、证书路径、用户名密码等需根据实际情况替换。
  • 常用排查指令可快速定位问题。
  • 通过logrotate压缩轮转日志文件。

Footnotes

  1. https://github.com/go-gost/gost/raw/master/install.sh

  2. https://github.com/gost/docs/blob/master/gost_installation.md

  3. https://junwu.shouyicheng.com/guides/gost/

本文作者:拾光小学生

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-ND 4.0 许可协议。转载请注明出处!