|
|
6 miesięcy temu | |
|---|---|---|
| configs | 6 miesięcy temu | |
| services | 6 miesięcy temu | |
| v2ray | 6 miesięcy temu | |
| vhost | 6 miesięcy temu | |
| .env.example | 6 miesięcy temu | |
| .gitignore | 6 miesięcy temu | |
| LICENSE | 2 lat temu | |
| README.md | 6 miesięcy temu | |
| cloudflare_ip_list.txt | 2 lat temu | |
| debug-location.conf | 6 miesięcy temu | |
| docker-compose.modular.yml | 6 miesięcy temu | |
| docker-compose.yml | 6 miesięcy temu | |
| easy-install.sh | 6 miesięcy temu | |
| generate-config.sh | 6 miesięcy temu | |
| install-docker.sh | 6 miesięcy temu | |
| setup-logging.sh | 6 miesięcy temu | |
| setup.py | 2 lat temu | |
| vmess.py | 2 lat temu |
Effortlessly deploy V2Ray with Docker, featuring multi-protocol support and fully optimized for compatibility with Cloudflare and other major CDNs.
The v2ray-nginx-cloudflare project provides both original and modular deployment options for a secure, scalable V2Ray instance using Docker containers. This architecture enables seamless integration with Cloudflare and CDNs, offering enhanced security, obfuscation, and performance.
Whether you're looking to bypass restrictions or set up a robust private proxy, this solution prioritizes reliability, compatibility, and ease of deployment.
One-command installation - automatically detects your system and sets up everything:
sudo bash <(curl -s https://raw.githubusercontent.com/samrand96/v2ray-nginx-cloudflare/main/easy-install.sh)
What it does:
The modular setup supports three Cloudflare-compatible protocols:
/grpc/wsv2ray-nginx-cloudflare/
├── .env # ⭐ SINGLE source of truth (all config here)
├── .env.example # Configuration template
├── docker-compose.modular.yml # Multi-protocol setup
├── docker-compose.yml # Original setup (preserved)
├── generate-config.sh # Script to regenerate V2Ray config
├── vhost/
│ └── default # Nginx location blocks for all protocols
├── configs/
│ └── nginx.tmpl # Nginx-proxy template
└── v2ray/config/
├── config.template.json # V2Ray config template
└── config.json # Generated V2Ray config
.env file - All services read from one place.env and restart servicesHetzner offers excellent performance and value:
Replace your-domain.com and your-uuid with your actual values:
vless://[email protected]:443?type=ws&security=tls&path=%2Fvless-ws&host=your-domain.com#VLESS-WS
vless://[email protected]:443?type=grpc&security=tls&serviceName=grpc&host=your-domain.com#VLESS-gRPC
vmess://eyJ2IjoiMiIsInBzIjoiVk1lc3MtV1MiLCJhZGQiOiJ5b3VyLWRvbWFpbi5jb20iLCJwb3J0IjoiNDQzIiwidHlwZSI6Im5vbmUiLCJpZCI6InlvdXItdXVpZCIsImFpZCI6IjAiLCJuZXQiOiJ3cyIsInBhdGgiOiIvdm1lc3Mtd3MiLCJob3N0IjoieW91ci1kb21haW4uY29tIiwidGxzIjoidGxzIn0=
If you prefer manual setup or need custom configuration:
Create an A record pointing to your server's IP. Temporarily disable CDN proxy.
# Download and run our universal installer
curl -fsSL https://raw.githubusercontent.com/samrand96/v2ray-nginx-cloudflare/main/install-docker.sh | sudo bash
git clone https://github.com/samrand96/v2ray-nginx-cloudflare.git
cd v2ray-nginx-cloudflare
# Copy environment template
cp .env.example .env
# Generate UUID
UUID=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)
# Edit the SINGLE configuration file
nano .env # Set DOMAIN, LETSENCRYPT_EMAIL, and V2RAY_UUID
# Generate V2Ray config from template
./generate-config.sh
# Start all services
docker compose -f docker-compose.modular.yml up -d
# Generate UUID
UUID=$(uuidgen)
# Update config
sed -i "s/<UPSTREAM-UUID>/$UUID/g" v2ray/config/config.json
sed -i "s/YOUR_DOMAIN/your-domain.com/g" docker-compose.yml
sed -i "s/YOUR_EMAIL/[email protected]/g" docker-compose.yml
# Start services
docker compose up -d
Return to your DNS settings and enable the proxy/CDN feature.
All configuration is in the root .env file:
# Domain and SSL
DOMAIN=your-domain.com
[email protected]
# V2Ray UUID (generate with: uuidgen)
V2RAY_UUID=your-uuid-here
# Protocol ports (fixed in vhost/default)
VLESS_WS_PORT=1310 # VLESS WebSocket
VLESS_GRPC_PORT=1311 # VLESS gRPC
VMESS_WS_PORT=1312 # VMess WebSocket
# Protocol paths
VLESS_WS_PATH=/
VLESS_GRPC_SERVICE=grpc
VMESS_WS_PATH=/ws
After editing .env, regenerate V2Ray config:
./generate-config.sh
docker compose -f docker-compose.modular.yml restart v2ray
Add to .env file:
CPU_LIMIT=1.0
MEMORY_LIMIT=512M
MEMORY_RESERVATION=256M
# Individual service control
docker compose -f docker-compose.modular.yml stop v2ray
docker compose -f docker-compose.modular.yml start nginx
docker compose -f docker-compose.modular.yml restart nginx-proxy-acme
# Rebuild and restart
docker compose -f docker-compose.modular.yml up -d --force-recreate
# View logs
docker compose -f docker-compose.modular.yml logs -f v2ray
docker compose -f docker-compose.modular.yml logs -f nginx
.env files# Check service status
docker compose -f docker-compose.modular.yml ps
# View all logs
docker compose -f docker-compose.modular.yml logs
# Test configuration
docker compose -f docker-compose.modular.yml exec v2ray v2ray -test -config /etc/v2ray/config.json
# Check ACME logs
docker compose -f docker-compose.modular.yml logs nginx-proxy-acme
# Force renewal
docker compose -f docker-compose.modular.yml exec nginx-proxy-acme /app/force_renew
# Stop all services
docker compose -f docker-compose.modular.yml down
# Clean rebuild
docker compose -f docker-compose.modular.yml build --no-cache
docker compose -f docker-compose.modular.yml up -d
docker compose -f docker-compose.modular.yml ps
docker compose -f docker-compose.modular.yml logs v2ray
docker compose -f docker-compose.modular.yml logs nginx
docker compose -f docker-compose.modular.yml logs dockergen
docker compose -f docker-compose.modular.yml exec v2ray netstat -tlnp
docker compose -f docker-compose.modular.yml exec nginx curl -I http://v2ray:1310
docker compose -f docker-compose.modular.yml exec nginx cat /etc/nginx/conf.d/default.conf
docker compose -f docker-compose.modular.yml exec v2ray cat /etc/v2ray/config.json
| Protocol | Speed | CPU Usage | Compatibility | Cloudflare CDN |
|---|---|---|---|---|
| VLESS+WS | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ✅ Excellent |
| VLESS+gRPC | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ✅ Good |
| VMess+WS | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ✅ Good |
| Feature | Original Setup | Modular Setup |
|---|---|---|
| Protocols | VMess only | VLESS + VMess + gRPC |
| Customization | Limited | Extensive |
| Performance | Good | Excellent |
| Maintenance | Manual | Automated |
| CDN Optimization | Basic | Advanced |
| Resource Control | No | Yes |
Connection Details:
{
"outbounds": [{
"protocol": "vless",
"settings": {
"vnext": [{
"address": "your-domain.com",
"port": 443,
"users": [{
"id": "your-generated-uuid",
"encryption": "none"
}]
}]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"wsSettings": {
"path": "/",
"headers": {
"Host": "your-domain.com"
}
},
"tlsSettings": {
"serverName": "your-domain.com"
}
}
}]
}
proxies:
- name: "VLESS-WS"
type: vless
server: your-domain.com
port: 443
uuid: your-generated-uuid
network: ws
tls: true
ws-opts:
path: /
headers:
Host: your-domain.com
Connection Details:
{
"outbounds": [{
"protocol": "vless",
"settings": {
"vnext": [{
"address": "your-domain.com",
"port": 443,
"users": [{
"id": "your-generated-uuid",
"encryption": "none"
}]
}]
},
"streamSettings": {
"network": "grpc",
"security": "tls",
"grpcSettings": {
"serviceName": "grpc"
},
"tlsSettings": {
"serverName": "your-domain.com"
}
}
}]
}
Connection Details:
{
"outbounds": [{
"protocol": "vmess",
"settings": {
"vnext": [{
"address": "your-domain.com",
"port": 443,
"users": [{
"id": "your-generated-uuid",
"alterId": 0,
"security": "auto"
}]
}]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"wsSettings": {
"path": "/ws",
"headers": {
"Host": "your-domain.com"
}
},
"tlsSettings": {
"serverName": "your-domain.com"
}
}
}]
}
We welcome contributions! For issues, improvements, or new features:
For questions or support, open an issue in the GitHub repository.
This project is licensed under the terms specified in the LICENSE file.