/v2ray-docker-compose

V2Ray Docker Compose (Bridge/Relay and Upstream Servers, Websockets + TLS + CDN) [VMESS & Shadowsocks]

Primary LanguagePython

V2Ray Docker Compose

This repository contains V2Ray-based solutions for bypassing firewalls in highly restricted networks where direct access to upstream servers (servers with free internet access) is unavailable.

Table of contents

Server Solutions

V2Ray Upsream and Relay Servers

This solution is stable and supports Shadowsocks and VMess protocols by default.

You will need two types of servers:

  • Upstream Server: A server with access to the free internet, likely located in a foreign data center.
  • Relay Server: A server that can connect to the upstream server and is accessible to users, likely located in the same region as the users.
(Users) <-> [ Relay Server ] <-> [ Upstream Server ] <-> (Internet)

Step 1: Setup Upstream Server

  1. Install Docker and Docker-compose.
  2. Copy the v2ray-upstream-server and the utils directories into the upstream server.
  3. Run ./utils/bbr.sh to speed up server network.
  4. Run cat /proc/sys/kernel/random/uuid in your terminal to generate a UUID.
  5. Replace <UPSTREAM-UUID> in v2ray/config/config.json with the generated UUID.
  6. Run docker-compose up -d.

Step 2: Setup Relay Server

  1. Install Docker and Docker-compose.
  2. Copy the v2ray-relay-server and the utils directories into the relay server.
  3. Run ./utils/bbr.sh to speed up server network.
  4. Replace the following variables in v2ray/config/config.json with appropriate values.
    • <SHADOWSOCKS-PASSWORD>: A password for Shadowsocks users like FR33DoM.
    • <BRIDGE-UUID>: A new UUID for relay server (Run cat /proc/sys/kernel/random/uuid).
    • <UPSTREAM-IP>: The upstream server IP address (like 13.13.13.13).
    • <UPSTREAM-UUID>: The upstream server UUID from the previous step.
  5. Run docker-compose up -d.
  6. Run ./clients.py to generate client configurations and links.

V2Ray Behind a CDN Service

This solution is recommended only if you don't have relay server to implement other solutions.

In this solution, you need one server (upstream) and a domain/subdomain added to a CDN service.

(Users) <-> [ CDN Service ] <-> [ Upstream Server ] <-> (Internet)

This solution provides VMESS over Websockets + TLS + CDN. Read more...

Follow these steps to set up V2Ray + Caddy (Web server) + CDN:

  1. On your CDN, create an A record pointing to your server IP with the proxy option turned off.
  2. Install Docker and Docker-compose on your server.
  3. Copy the v2ray-caddy-cdn and the utils directories into the server.
  4. Run ./utils/bbr.sh to speed up server network.
  5. Run cat /proc/sys/kernel/random/uuid to generate a UUID.
  6. Replace <UPSTREAM-UUID> in v2ray/config/config.json with the generated UUID.
  7. Replace <EXAMPLE.COM> in caddy/Caddyfile with your domain/subdomain.
  8. Run docker-compose up -d.
  9. Visit your domain/subdomain in your web browser. Wait until the homepage is loaded.
  10. (Optional) In your CDN, turn the proxy option on for the record.
  11. Run ./vmess.py to generate client configuration (link).

If you prefer NGINX as the web server, read V2RAY_NGINX_CDN instead.

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 10) 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.

V2Ray as Relay for Outline

This highly recommended solution is stable and easy to set up. Using the Outline Manager app, you can create and manage multiple users and track their traffic. It supports Shadowsocks protocol and offers the easy-to-use Outline client app.

Read more: Outline Bridge Server

Client Applications

Shadowsocks Protocol

This is the list of recommended applications to use the Shadowsocks protocol:

VMess Protocol

This is the list of recommended applications to use the VMess and other protocols:

HTTP and SOCKS Protocols

Moved here: HTTP_SOCKS

More