Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

zxcvos/Xray-script

Repository files navigation

中文 | English

Xray-XHTTP 管理脚本 ✨

  • 一个纯 Shell 编写的 XHTTP 管理脚本
  • 可选配置:
    • mKCP (VLESS-mKCP-seed)
    • Vision (VLESS-Vision-REALITY)
    • XHTTP (VLESS-XHTTP-REALITY)
    • trojan (Trojan-XHTTP-REALITY)
    • Fallback (包含 VLESS-Vision-REALITY、VLESS-XHTTP-REALITY)
    • SNI (包含 Vision_REALITY、XHTTP_REALITY、XHTTP_TLS)
  • SNI 配置由 Nginx 实现 SNI 分流,适合过 CDN、上下行分离、多网站共存等需求
  • SNI 分享链接实现了上下行分离(上行 xhttp+TLS+CDN | 下行 xhttp+Reality、上行 xhttp+Reality | 下行 xhttp+TLS+CDN)
  • 规则配置与自填:
    • 禁止 bittorrent 流量(可选)
    • 禁止回国 ip 流量(可选)
    • 屏蔽广告(可选)
    • 添加自定义 WARP Proxy 分流
    • 添加自定义屏蔽分流
  • 开关 Cloudflare WARP Proxy( 🐳 Docker 部署)
  • 开关 geodata 自动更新功能
  • xray 端口默认与自填:
    • VLESS-mKCP: 随机生成
    • ALL-REALITY: 443
  • UUID 默认与自填:
    • 随机生成
    • 自定义输入标准 UUID
    • 非标准 UUID 映射转化为 UUID
  • kcp(seed) 和 trojan(password) 默认与自填:
    • 随机生成(格式: cw-GEMDYgwIV3_g#)
    • 自定义输入
  • target 默认与自填:
    • 随机在 serverNames.json 中获取
    • 实现自填 target 的 TLSv1.3 与 H2 验证
    • 实现自填 target 的 serverNames 自动获取
  • shortId 默认与自填:
    • 随机生成(默认两个 shortId 例如: 01234567, 0123456789abcdef)
    • 实现自填 shortId
    • 实现输入值为 0 到 8, 则自动生成对 0-16 长度的 shortId
    • 支持逗号分隔的多个值
  • path 默认与自填:
    • 随机生成(格式: /8ugSUeNJ.9OEnTErb.dVZMUAFu)
    • 自定义输入(格式: /8ugSUeNJ, 加不加 / 都可以)

问题

  1. 如果安装成功,但无法使用,请检查服务器是否开启对应端口。
  2. 使用 SNI 配置前,请确保 VPS 的 HTTP(80) 与 HTTPS(443) 端口开放。
  3. 使用 SNI 配置前,请不要开启 CDN 保护,不然无法正常申请 SSL 证书。
  4. 上下行分离详情请看 XHTTP: Beyond REALITYxhttp 五合一配置 了解。

可通过 https://tcp.ping.pe/ip:port 验证服务器端口是否开放。

分享链接

基于VMessAEAD / VLESS 分享链接标准提案v2rayN实现,如果其他客户端无法正常使用,请自行根据分享链接进行修改。

SNI 配置中,CDN 的分享链接 Alpn 默认为 H2,如有 H3 需求,请自行在客户端修改。

如何使用

  • 获取

    wget --no-check-certificate -O ${HOME}/Xray-script.sh https://raw.githubusercontent.com/zxcvos/Xray-script/main/xhttp.sh
  • 使用

    bash ${HOME}/Xray-script.sh
  • 快速启动

    wget --no-check-certificate -O ${HOME}/Xray-script.sh https://raw.githubusercontent.com/zxcvos/Xray-script/main/xhttp.sh && bash ${HOME}/Xray-script.sh

脚本界面

 __   __  _    _   _______   _______   _____  
 \ \ / / | |  | | |__   __| |__   __| |  __ \ 
  \ V /  | |__| |    | |       | |    | |__) |
   > <   |  __  |    | |       | |    |  ___/ 
  / . \  | |  | |    | |       | |    | |     
 /_/ \_\ |_|  |_|    |_|       |_|    |_|     

Copyright (C) zxcvos | https://github.com/zxcvos/Xray-script

-------------------------------------------
Xray       : v24.12.31
CONFIG     : VLESS-XHTTP-REALITY
WARP Proxy : 已启动
-------------------------------------------

--------------- Xray-script ---------------
 Version      : v2024-12-31
 Description  : Xray 管理脚本
----------------- 装载管理 ----------------
1. 完整安装
2. 仅安装/更新
3. 卸载
----------------- 操作管理 ----------------
4. 启动
5. 停止
6. 重启
----------------- 配置管理 ----------------
7. 分享链接与二维码
8. 信息统计
9. 管理配置
-------------------------------------------
0. 退出

已测试系统

Platform Version
Debian 10, 11, 12
Ubuntu 20, 22, 24
CentOS 7, 8, 9
Rocky 8, 9

以上发行版均通过 Vultr 测试安装。

其他 Debian 基系统与 Red Hat 基系统可能能用,但未测试过,可能存在问题。

安装时长说明

SNI 配置适合安装一次后长期使用,不适合反复重置系统安装,这会消耗您的大量时间。如果需要更换配置和域名等,在管理界面都有相应的选项。

更换为非 SNI 配置后,Nginx 将停止服务,但会继续保留在本机,再启用 SNI 配置时不会进行重新安装。

安装时长参考

安装流程:

更新系统管理包->安装依赖->安装Docker->安装Cloudreve->[安装Cloudflare-warp]->安装Xray->安装Nginx->申请证书->配置文件

这是一台单核1G的服务器的平均安装时长,仅供参考:

项目 时长
更新系统管理包 0-10分钟
安装依赖 0-5分钟
安装Docker 1-2分钟
安装Cloudreve 3-5分钟
安装Cloudflare-warp 3-5分钟
安装Xray <半分钟
安装Nginx 13-15分钟
申请证书 1-2分钟
配置文件 <100毫秒

为什么 SNI 配置安装时间那么长?

脚本的 Nginx 是采用源码编译的形式进行管理安装。

编译相比直接安装二进制文件的优点有:

  1. 运行效率高 (编译时采用了-O3优化)
  2. 软件版本新

缺点就是编译耗时长。

安装位置

Xray-script: /usr/local/xray-script

Nginx: /usr/local/nginx

Cloudreve: /usr/local/cloudreve

Cloudflare-warp: /usr/local/cloudflare_warp

Xray:Xray-install

依赖列表

使用 SNI 配置时,脚本可能自动安装以下依赖:

用途 Debian基系统 Red Hat基系统
yumdb set(标记包手动安装) yum-utils
dnf config-manager dnf-plugins-core
IP 获取 iproute2 iproute
DNS 解析 dnsutils bind-utils
wget wget wget
curl curl curl
wget/curl https ca-certificates ca-certificates
kill/pkill/ps/sysctl/free procps procps-ng
epel源 epel-release
epel源 epel-next-release
remi源 remi-release
防火墙 ufw firewalld
编译基础:
下载源码文件 wget wget
解压tar源码文件 tar tar
解压tar.gz源码文件 gzip gzip
gcc gcc gcc
g++ g++ gcc-c++
make make make
acme.sh依赖:
curl curl
openssl openssl
cron crontabs
编译openssl:
perl-base(包含于libperl-dev) perl-IPC-Cmd
perl-modules-5.32(包含于libperl-dev) perl-Getopt-Long
libperl5.32(包含于libperl-dev) perl-Data-Dumper
perl-FindBin
编译Brotli:
git git
libbrotli-dev brotli-devel
编译Nginx:
libpcre2-dev pcre2-devel
zlib1g-dev zlib-devel
--with-http_xslt_module libxml2-dev libxml2-devel
--with-http_xslt_module libxslt1-dev libxslt-devel
--with-http_image_filter_module libgd-dev gd-devel
--with-google_perftools_module libgoogle-perftools-dev gperftools-devel
--with-http_geoip_module libgeoip-dev geoip-devel
--with-http_perl_module perl-ExtUtils-Embed
libperl-dev perl-devel

致谢

Xray-core

REALITY

XHTTP: Beyond REALITY

integrated-examples

xhttp 五合一配置

部署 Cloudflare WARP Proxy

cloudflare-warp 镜像

V2Ray 路由规则文件加强版

kirin10000/Xray-script

Cloudreve

此脚本仅供交流学习使用,请勿使用此脚本行违法之事。网络非法外之地,行非法之事,必将接受法律制裁。

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.