Clash Setup Guide: Build an Xray Proxy Node from Scratch
This guide explains how to set up a proxy node for Clash using Xray, including server preparation, installation, configuration, port setup, and client integration, along with troubleshooting and optimization tips.
Clash Setup Guide: Build an Xray Proxy Node from Scratch
1. Introduction
Clash is a proxy client and does not provide proxy services by itself.
This means:
👉 To use Clash, you must first have a working proxy node.
The typical approach is:
Deploy a proxy service (e.g., Xray) on a cloud server
Connect to it using Clash on your local device
2. Architecture Overview
The basic workflow looks like this:
Local Device (Clash)
↓
Cloud Server (Xray)
↓
Target WebsiteIn short:
👉 Clash = client
👉 Xray = proxy provider
3. Server Preparation
Before starting, prepare a cloud server.
Requirements
OS: Ubuntu 20.04 / 22.04
CPU/RAM: at least 1 Core / 1 GB
Public IP required
Ports
You need to open a port, for example:
10086(for testing)443(recommended for production)
4. Install Xray
Run the following command to install Xray:
bash <(curl -Ls https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh)After installation, the service will be registered automatically.
5. Configure Xray
Edit the configuration file:
nano /usr/local/etc/xray/config.jsonExample configuration:
{
"inbounds": [
{
"port": 10086,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "YOUR_UUID",
"alterId": 0
}
]
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}Generate UUID
Run:
cat /proc/sys/kernel/random/uuidReplace YOUR_UUID with the generated value.
6. Start Service and Open Port
Start Xray
systemctl restart xray
systemctl enable xrayOpen port (using ufw)
ufw allow 10086If you are using a cloud provider (AWS, Alibaba Cloud, etc.), make sure to allow the port in the security group as well.
7. Configure Clash
Add the following to your config.yaml:
proxies:
- name: my-node
type: vmess
server: YOUR_SERVER_IP
port: 10086
uuid: YOUR_UUID
alterId: 0
cipher: autoSave the file and select the node in Clash.
8. Optional Optimizations
After basic setup, you can improve security and performance:
Enable TLS
Encrypt traffic to avoid detection.
Use Reality / WebSocket
Improve stealth and compatibility.
Bind a domain
Use a domain instead of raw IP.
Use CDN (e.g., Cloudflare)
Enhance stability and hide your real IP.
9. Common Issues
Cannot connect
Check:
Xray service status
Port availability
UUID correctness
Slow speed
Possible reasons:
Low server bandwidth
Poor network routing
Suboptimal protocol
👉 Consider changing server location or protocol.
View logs
journalctl -u xray -fUse this to monitor runtime logs and debug issues.
10. Conclusion
The overall process is straightforward:
Buy a cloud server
Install Xray
Configure the service
Open the port
Add the node to Clash