Menu-driven helper script for preparing a VPS to run a 3x-ui xhttp node behind Nginx and Cloudflare.
bash <(curl -Ls https://raw.githubusercontent.com/wangxvwei/xhttp-node/main/install.sh)If this repository is private, the command above will not work from a fresh VPS unless GitHub authentication is provided. For a 3x-ui-style public one-command installer, make the repository public first.
This script is intentionally conservative:
- It does not write to the 3x-ui database.
- It prepares system packages, Cloudflare Origin certificates, Nginx routing, static site directories, backups, checks, and a shortcut command.
- It prints the selected 3x-ui inbound and client-facing parameters after reading the VPS configuration.
- It reads the current 3x-ui panel port and web base path from the VPS when possible, instead of assuming a fixed panel backend port.
- 3x-ui is the source of truth for panel/subscription ports, paths, and backend HTTP/HTTPS state. Nginx proxy settings are regenerated from the current 3x-ui state.
- If the 3x-ui panel backend path is
/, the panel subdomain proxies/so absolute assets such as/assets/...keep working. - The panel backend port, protocol, and public path are read from 3x-ui and are not normal editable prompts. Change them in 3x-ui first, then rerun this script.
- The script does not create or edit xhttp inbounds in 3x-ui. Create the xhttp inbound manually in the panel first.
- When configuring Nginx, the script reads existing 3x-ui xhttp inbounds from the VPS and can proxy all, multiple selected, or one selected inbound by Path and local port.
- It can also read the enabled 3x-ui subscription service and add a panel-domain reverse proxy such as
https://panel.example.com/dingyue/ -> http://127.0.0.1:2096/dingyue/. - For subscription reverse proxy, the script prints the public URI that should be filled into 3x-ui's reverse proxy URI field. It still does not write to the 3x-ui database.
- The default static site includes a custom
404.htmlwith a home button so meaningless non-xhttp paths do not expose the default Nginx error page. - Nginx changes are backed up and tested before reload; failed tests roll back automatically.
Main flow:
<domain>/ -> static site directory from VPS config/input
<domain>/<xhttp-path> -> 127.0.0.1:<xhttp-port> (read from a 3x-ui xhttp inbound)
<panel-domain>/<path> -> detected 3x-ui panel backend
<panel-domain>/<sub-path> -> detected 3x-ui subscription backend
Usage on a fresh Debian/Ubuntu VPS:
chmod +x xhttp-node.sh
sudo ./xhttp-node.shFirst-time flow is intentionally not a strict 1 -> 2 -> 3 -> 4 sequence. Open the built-in guide first:
15. 使用说明 / 推荐流程
The usual order is:
1. 安装基础环境
2. 安装/检查 3x-ui
14. 查看 3x-ui 当前状态(只读)
在 3x-ui 中完成面板/订阅/xhttp 入站配置
14. 再次查看 3x-ui 当前状态(只读)
3. 配置 Cloudflare 域名和源站证书
4. 配置 Nginx 443 分流
8/9/13. 检查
After installing the shortcut from the menu, run:
xhttp-nodeDo not paste private keys, Cloudflare tokens, or VPS passwords into this repository.