第一步、抢一台香港服务器:https://hjyl.org/get-aliyun-hongkong-light-vps/
第二步、配置工具:https://u.sb/debian-install-docker/
第三步、编写配置文件
1、docker-compose.yml
mkdir v2ray
vim docker-compose.yml
version: "3.4"
services:
v2ray:
image: v2ray/official:latest
container_name: v2ray
restart: always
networks:
- v2ray
volumes:
- ./v2ray:/etc/v2ray
nginx:
image: nginx:alpine
container_name: nginx
networks:
- v2ray
ports:
- 80:80
- 443:443
links:
- v2ray
volumes:
- ./nginx/certs:/etc/nginx/certs #证书地址
- ./nginx/conf.d:/etc/nginx/conf.d #nginx配置文件
- ./nginx/logs:/var/log/nginx #nginx配置文件
- ./nginx/www:/www
- /etc/localtime:/etc/localtime:ro
restart: always
networks:
v2ray:
2、nginx 配置文件
vim nginx/conf.d/v2ray.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://$host$request_uri;
}
server {
server_name 你的域名 ;
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_requests 25600;
keepalive_timeout 65;
proxy_buffering off;
proxy_buffer_size 8k;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/nginx/certs/你的.pem;
ssl_certificate_key /etc/nginx/certs/你的.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
add_header Strict-Transport-Security "max-age=63072000" always;
ssl_stapling on;
ssl_stapling_verify on;
resolver 127.0.0.1;
location /v2ray {
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 300s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://v2ray:9000;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
}
3、v2ray配置文件
vim v2ray/config.json
{
"inbounds": [
{
"port": 9000,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "uuid生成",
"level": 0,
"alterId": 100
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/v2ray"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
第三步、启动
docker compose up -d
第四步:下载客户端地址:https://github.com/2dust/v2rayN/releases



参考路径
https://github.com/2dust/v2rayN/releases
https://github.com/chuanjin-su/v2fly-docker-compose