Skip to content

ArtemKiyashko/Xray-script

 
 

Repository files navigation

English | 中文

Xray Management Script ✨

  • A pure Shell-written Xray management script for Xray
  • Optional configurations:
    • mKCP (VLESS-mKCP-seed)
    • Vision (VLESS-Vision-REALITY)
    • XHTTP (VLESS-XHTTP-REALITY)
    • trojan (Trojan-XHTTP-REALITY)
    • Fallback (includes VLESS-Vision-REALITY, VLESS-XHTTP-REALITY)
    • SNI (includes Vision_REALITY, XHTTP_REALITY, XHTTP_TLS)
  • SNI configuration uses Nginx for SNI traffic splitting, ideal for CDN traversal, upstream/downstream separation, and multi-site coexistence
  • SNI share links implement bidirectional separation (upstream: xhttp+TLS+CDN | downstream: xhttp+Reality, upstream: xhttp+Reality | downstream: xhttp+TLS+CDN)
  • Rule configurations and custom entries:
    • Block BitTorrent traffic (optional)
    • Block China IP traffic (optional)
    • Ad blocking (optional)
    • Add custom WARP Proxy rules
    • Add custom block rules
  • Cloudflare WARP Proxy toggle (🐳 Docker deployment)
  • Geodata auto-update toggle
  • Xray ports default/fill:
    • VLESS-mKCP: Randomly generated
    • ALL-REALITY: 443
  • UUID default/fill:
    • Randomly generated
    • Custom standard UUID input
    • Non-standard UUID mapping conversion
  • kcp(seed) and trojan(password) default/fill:
    • Random generation (format: cw-GEMDYgwIV3_g#)
    • Custom input
  • target default/fill:
    • Random selection from serverNames.json
    • TLSv1.3 and H2 validation for custom targets
    • Automatic serverNames acquisition for custom targets
  • shortId default/fill:
    • Random generation (default two shortIds e.g.: 01234567, 0123456789abcdef)
    • Custom shortId input
    • Numeric input 0-8 generates 0-16 length shortIds
    • Comma-separated multiple values
  • path default/fill:
    • Random generation (format: /8ugSUeNJ.9OEnTErb.dVZMUAFu)
    • Custom input (format: /8ugSUeNJ, with/without /)

Issues

  1. If the installation is successful but does not work properly, please check whether the server port is open. You can verify port accessibility through https://tcp.ping.pe/ip:port
  2. Before using SNI configuration, ensure VPS HTTP(80) and HTTPS(443) ports are open
  3. Before using SNI configuration, disable CDN protection to avoid SSL certificate issues
  4. For upstream/downstream separation details, see XHTTP: Beyond REALITY and xhttp 五合一配置
  5. When using SNI to obtain a certificate and encountering the error ["Could not get nonce, let's try again"], please check the ZeroSSL Status Page . It is highly likely that ZeroSSL's "Free ACME Service" is experiencing "Service disruption" or "Service outage"

Share Links

Based on VMessAEAD / VLESS 分享链接标准提案 and v2rayN. Modify links manually if other clients have compatibility issues.

In SNI configurations, CDN share links default Alpn to H2. For H3 requirements, modify client settings manually.

Usage

  • Download:

    wget --no-check-certificate -O ${HOME}/Xray-script.sh https://raw.githubusercontent.com/ArtemKiyashko/Xray-script/main/install.sh
  • Usage

    • Launch interface

      bash ${HOME}/Xray-script.sh
    • Quick install Vision

      bash ${HOME}/Xray-script.sh --vision
    • Quick install XHTTP

      bash ${HOME}/Xray-script.sh --xhttp
    • Quick install Fallback

      bash ${HOME}/Xray-script.sh --fallback
  • Quick start (with interface)

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

Client Management

The script includes a built-in client management system for VLESS-Vision-REALITY protocol configurations. This feature allows you to:

Features

  • List Clients - View all configured clients with their UUIDs and shortIds
  • Add Clients - Create new client configurations with automatic UUID and shortId generation
  • Delete Clients - Remove clients while maintaining array synchronization
  • Generate Share Links - Create client-specific share links and QR codes

Key Details

  • ShortId Management: Each client has a corresponding shortId. When adding a client, a new 8-byte (16 hex characters) shortId is automatically generated and added to the array.
  • Array Synchronization: When deleting a client, both the client entry and its corresponding shortId are removed to maintain index alignment between the clients and shortIds arrays.
  • Service Restart: After adding or deleting clients, the script prompts whether to restart the Xray service to apply changes immediately.

Access Client Management

  1. Launch the script main menu
  2. Select option 7. Manage Client Configuration

Usage Flow

Adding a Client:

1. Select "Add New Client"
2. Enter a unique client name (used as email identifier)
3. UUID and shortId are automatically generated
4. Optionally restart Xray service when prompted

Deleting a Client:

1. Select "Delete Client"
2. View the current client list
3. Enter the client number to delete
4. Confirm the deletion
5. Optionally restart Xray service when prompted

Warning: The client list shows a synchronization warning if the clients and shortIds arrays have different lengths, helping identify potential configuration issues.

Script Interface

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

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

------------------------------------------------------
Xray       : v25.10.15
CONFIG     : Vision
WARP Proxy : Disabled
------------------------------------------------------

--------------- Xray-script ------------------
Version      : v2025.10.21
Description  : Xray Management Script
------------------ Installation ------------------
1. Full Installation
2. Install/Update Only
3. Uninstall
------------------ Operation ------------------
4. Start
5. Stop
6. Restart
------------------ Configuration ------------------
7. Manage Client Configuration
8. Traffic Statistics
9. Manage Configuration
------------------------------------------------------
0. Exit

Tested Systems

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

All tested on Vultr instances. Other Debian/Red Hat derivatives might work but are untested.

Installation Time Notes

SNI configuration is designed for long-term use after initial setup. Reinstalling systems frequently will consume significant time. Use configuration management options for domain/setting changes.

When switching from SNI configuration, Nginx stops but remains installed. Reactivating SNI won't trigger reinstallation.

Installation Time Reference (1CPU/1GB)

Process Duration
Update system packages 0-10 minutes
Install dependencies 0-5 minutes
Install Docker 1-2 minutes
Install Cloudreve 3-5 minutes
Install Cloudflare-warp 3-5 minutes
Install Xray < half a minute
Install Nginx 13-15 minutes
Issue certificates 1-2 minutes
Configuration files < 100 milliseconds

Why does the script installation take so long?

Nginx in the script is managed by compiling from source.

The advantages of compiling include:

  1. High runtime efficiency (optimized with -O3 during compilation)
  2. Newer software versions

The drawback is that compilation takes a long time.

Installation Paths

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

Nginx: /usr/local/nginx

Cloudreve: /usr/local/cloudreve

Cloudflare-warp: /usr/local/cloudflare_warp

Xray: See Xray-install

Dependencies

SNI configuration may install these dependencies:

Purpose Debian-based Systems Red Hat-based Systems
yumdb set (mark packages for manual installation) yum-utils
dnf config-manager dnf-plugins-core
IP retrieval iproute2 iproute
DNS resolution 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 repository epel-release
epel repository epel-next-release
remi repository remi-release
Firewall ufw firewalld
Compilation Basics:
Download source files wget wget
Unzip tar source files tar tar
Unzip tar.gz source files gzip gzip
gcc gcc gcc
g++ g++ gcc-c++
make make make
acme.sh Dependencies:
curl curl
openssl openssl
cron crontabs
Compile openssl:
perl-base (included in libperl-dev) perl-IPC-Cmd
perl-modules-5.32 (included in libperl-dev) perl-Getopt-Long
libperl5.32 (included in libperl-dev) perl-Data-Dumper
perl-FindBin
Compile Brotli:
git git
libbrotli-dev brotli-devel
Compile 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

Credits

Xray-core

REALITY

XHTTP: Beyond REALITY

integrated-examples

xhttp 五合一配置

部署 Cloudflare WARP Proxy

cloudflare-warp 镜像

V2Ray 路由规则文件加强版

kirin10000/Xray-script

Cloudreve

This script is for educational purposes only. Do not use it for illegal activities.

About

Xray-XHTTP 管理脚本

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 99.8%
  • Dockerfile 0.2%