Why use XRay instead of V2Ray

In my previous blog, I have mentioned using V2Ray to bypass government restrictions of social media and other sites.

What's wrong with V2Ray?

V2Ray is great option but the problem stems from it's scalability. It creates an extra process whenever a new user is added to the V2Ray network. This creates huge problems when there are hundreds of users in the system. Connections can be lost and processes can be dropped to accomodate other system processes or just save memory.

Enter Xray: Built for Scale

Xray-core, a powerful fork of V2Ray, was created to address these exact issues. It maintains protocol compatibility with V2Ray but introduces fundamental architectural improvements, including:

  • Centralized process model: No more spawning new child processes per user. Instead, multiple users can be handled within a single runtime instance efficiently.

  • Reality protocol support: A newer, TLS-free obfuscation method that’s more stealthy, lighter, and CDN-free.

  • Improved routing and load handling: Thanks to an optimized networking stack and modern event-loop architecture.

  • Better TLS (XTLS) implementation: Especially with xtls-rprx-vision, providing faster handshakes and lower latency.

This makes Xray the obvious choice for operators who:

  • Manage many individual users, each with their own UUID and shortId.

  • Want granular control over client access.

  • Need to minimize overhead and maximize connection reliability.

Installation

Getting Xray set up is simple thanks to the community-maintained installation script. Here's how you can get started with a clean and secure setup using Reality and VLESS.

Step 1: Install Xray-core

Run the official installation script:

This:

  • Installs the latest stable xray-core binary.

  • Creates default config and systemd service files.

  • Sets up paths like /usr/local/bin/xray and /etc/xray/.

Step 2: Configure Xray with Reality + VLESS

Edit the main configuration file:

Paste in your configuration (updated with real values):

  • REPLACE-WITH-UUID – You can generate one with uuidgen.

  • REPLACE-WITH-PRIVATE-KEY – Generate using xray x25519.

  • Your server Names should be replace with a domain name that you own that points to the VPS

Step 3: Generate Reality Keys

Use the built-in xray generator:

You'll get something like:

  • Use the private key in your server config.

  • Share the public key with clients.

Step 4: Enable and Start Xray

Check if it's running:

Or view logs:

Step 5: Open firewall ports (if needed)

Below is an example if you have uncomplicated firewall (ufw) enabled

Step 6: Connect the Clients

You’ll need:

  • Server IP or domain

  • Port (e.g., 8445)

  • UUID

  • Flow: xtls-rprx-vision

  • Public key

  • ShortId (e.g., b1)

  • Server name (e.g., www.microsoft.com) (where ever you have pointed the vps domain to)

My Helper Script: add_connection.sh

Once your Xray server is up and running, you’ll eventually face the challenge of adding new users efficiently, especially if you’re offering access to friends, clients, or community members.

Typing in a complex vless:// URL manually with:

  • A UUID

  • A public key

  • A shortId

  • A Reality server name

Is truly painful when you're on mobile. That’s why I wrote a simple helper script: add_connection.sh.

Before you can run the script, make sure it’s executable:

Then, you can run it with:

This example starts from port 8445 and creates three unique inbound connections on ports 8445, 8446, and 8447.

Each of these connections will:

  • Use a random UUID

  • Share a common Reality keypair (generated automatically)

  • Be appended to your existing config.json

  • Restart-ready (just reload Xray to apply changes)

For each connection created, the script generates a scannable QR code image using qrencode. These images are saved in your current directory:

You can then download them and send them to your users as you want.

QR Supported Clients

IOS

Android

Windows

MacOS

Last updated