Xray Server Docker Compose ( Vmess + Websockets + TLS + CDN )
In this solution, you need to buy a vps and a domain/subdomain added to a CDN service.
VPS : A server that has free access to the Internet.
CDN Service: A Content delivery network like Cloudflare, ArvanCloud or DerakCloud.
(Client) <-> [ CDN Service ] <-> [ Server ] <-> (Internet)
This solution provides VMESS over Websockets + TLS + CDN.
Follow these steps to setup Xray + Caddy (Web server) + CDN:
- In your CDN, create an A record pointing to your server IP with the proxy option turned off.
- Install Docker and Docker-compose on your server.
- Git clone this repo into the server. (git clone https://github.com/old-joker/Xray-Docker-Compose.git)
- Run cat /proc/sys/kernel/random/uuid to generate a UUID.
- Replace in xray/config/config.json with the generated UUID.
- Replace <EXAMPLE.COM> in caddy/Caddyfile with your domain/subdoamin.
- Run docker compose up -d.
- Visit your domain/subdomain in your web browser. Wait until the homepage is loaded.
- (Optional) In your CDN, turn the proxy option on for the record.
- Run ./export.py to generate client configuration (link).
Some CDN services don't offer unlimited traffic for free plans. Please check CDN Free Plans.
You don't need to turn the cloud (proxy) on in your CDN (step 9) when the Internet is not blocked. When it's off, clients connect to the server directly and CDN services also don't charge you any fee.