前言 #
最近给一台美西 VPS 安装了 3X-UI 面板,记录一下完整过程供参考。3X-UI 是一个基于 Xray-core 的多协议代理管理面板,支持 VLESS、Reality、Hysteria2 等主流协议。
环境准备 #
- 服务器: Debian 12,1 核 2G 内存,30G SSD
- 域名: 需提前解析到 VPS IP
- SSH 工具: 任意 SSH 客户端
第一步:安装 Nginx #
apt update -y
apt install -y nginx
systemctl enable nginx --now第二步:配置 Nginx 站点 #
server {
listen 80;
server_name your-domain.com;
root /var/www/site;
index index.html;
}启用站点:
ln -sf /etc/nginx/sites-available/site /etc/nginx/sites-enabled/site
rm /etc/nginx/sites-enabled/default
nginx -t && nginx -s reload第三步:安装 3X-UI #
apt install -y curl socat
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)安装过程中选择 SQLite 数据库(选项 1),按需自定义面板端口。
第四步:配置 SSL 证书 #
使用 acme.sh 申请 Let’s Encrypt 域名证书:
curl https://get.acme.sh | sh
~/.acme.sh/acme.sh --issue -d your-domain.com --standalone --keylength ec-256将证书路径写入 3X-UI 数据库后重启面板即可。
第五步:配置防火墙 #
apt install -y ufw
ufw --force enable
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow <面板端口>/tcp
ufw allow <节点端口>/tcp
ufw allow <节点端口>/udp第六步:添加节点 #
VLESS + TCP + Reality #
- 协议:VLESS
- 传输:TCP
- 安全:Reality
- 目标:大厂域名:443
- Flow:xtls-rprx-vision
Hysteria2 #
- 协议:Hysteria
- 版本:v2
- 证书:使用 Let’s Encrypt 域名证书
内存优化小技巧 #
ServerStatus2 客户端的 cron 可能导致进程堆积。加上 pgrep 检查:
* * * * * pgrep -f serverstatus2 || SS_NAME=xxx python3 /opt/serverstatus2/client.py修复后内存从 1.6G 降到 300M,效果显著。
总结 #
全程在 SSH 命令行下完成。3X-UI 资源占用低(x-ui 约 70MB,xray 约 34MB),适合低配 VPS。证书通过 acme.sh 自动续期,无需手动维护。