|
这个问题已经困扰我3天了,一直没有解决,请教一下各位18cm的mjj该如何解决这个问题。
我使用了 docker compose 部署了 V2Ray 的 vmess + tls + ws 方案,容器可以正常运行,却一直无法连接。
下面的是我的配置文件,麻烦帮忙看一下,配置是否出错了。
docker-compose.yml (docker compose 配置文件)
[ol]version: '3'services: nginx: # 镜像 image: nginx # 容器名 container_name: nginx # 端口 ports: # 80 端口 - "80:80" # 443 端口 - "443:443" # 数据卷 volumes: # Nginx 配置文件夹 - "./nginx/config:/etc/nginx/conf.d" # Nginx 站点的根目录 - "./nginx/html:/html" # Nginx 日志文件夹 - "./nginx/log:/log" # SSL 证书文件夹 - "./nginx/ssl:/ssl" # 在容器退出时,总是重启容器 restart: always v2ray: # 镜像 image: v2ray/official # 容器名 container_name: v2ray # 数据卷 volumes: # V2Ray 配置文件 - ./v2ray/config/config.json:/etc/v2ray/config.json # V2Ray 访问日志文件 - ./v2ray/log/access.log:/var/log/v2ray/access.log # V2Ray 错误日志文件 - ./v2ray/log/error.log:/var/log/v2ray/error.log # 在容器退出时,总是重启容器 restart: always[/ol]复制代码
v2ray.conf (Nginx 配置文件)
[ol]server { listen 443 ssl; listen [::]:443 ssl; ssl_certificate /path/to/cert/file; ssl_certificate_key /path/to/cert/file; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; 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; server_name domain.com; # 与 V2Ray 配置中的 path 保持一致 location /v2ray { # WebSocket协商失败时返回404 if ($http_upgrade != "websocket") { return 404; } proxy_redirect off; # 假设WebSocket监听在环回地址的10000端口上 proxy_pass http://v2ray:1024; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; # Show real IP in v2ray access.log proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # 访问日志 access_log /log/domain.com.log;}[/ol]复制代码
V2Ray 服务器配置文件
[ol]{ "log": { "loglevel": "warning", "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log" }, "inbounds": [ { "port": 1024, "listen":"127.0.0.1", "protocol": "vmess", "settings": { "clients": [ { "id": "uuid", "alterId": 0 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path": "/v2ray" } } } ], "outbounds": [ { "protocol": "freedom", "settings": {} } ]}[/ol]复制代码
V2Ray 客户端配置文件
[ol]// 通过 V2RayN 导出为客户端配置文件{ "policy": { "system": { "statsOutboundUplink": true, "statsOutboundDownlink": true } }, "log": { "access": "", "error": "", "loglevel": "warning" }, "inbounds": [ { "tag": "socks", "port": 10808, "listen": "127.0.0.1", "protocol": "socks", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "settings": { "auth": "noauth", "udp": true, "allowTransparent": false } }, { "tag": "http", "port": 10809, "listen": "127.0.0.1", "protocol": "http", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "settings": { "udp": false, "allowTransparent": false } }, { "tag": "api", "port": 59712, "listen": "127.0.0.1", "protocol": "dokodemo-door", "settings": { "udp": false, "address": "127.0.0.1", "allowTransparent": false } } ], "outbounds": [ { "tag": "proxy", "protocol": "vmess", "settings": { "vnext": [ { "address": "domain.com", "port": 443, "users": [ { "id": "uuid", "alterId": 0, "email": "t@t.tt", "security": "auto" } ] } ] }, "streamSettings": { "network": "ws", "security": "tls", "tlsSettings": { "allowInsecure": true, "serverName": "domain.com" }, "wsSettings": { "path": "/v2ray", "headers": { "Host": "domain.com" } } }, "mux": { "enabled": false, "concurrency": -1 } }, { "tag": "direct", "protocol": "freedom", "settings": {} }, { "tag": "block", "protocol": "blackhole", "settings": { "response": { "type": "http" } } } ], "stats": {}, "api": { "tag": "api", "services": [ "StatsService" ] }, "routing": { "domainStrategy": "IPIfNonMatch", "domainMatcher": "linear", "rules": [ { "type": "field", "inboundTag": [ "api" ], "outboundTag": "api", "enabled": true }, { "type": "field", "port": "0-65535", "outboundTag": "proxy", "enabled": true } ] }}[/ol]复制代码
domain.com.log (Nginx 日志文件)
[ol]162.142.125.210 - - [19/Jul/2022:10:00:00 +0000] "GET / HTTP/1.1" 404 153 "-" "-"162.142.125.210 - - [19/Jul/2022:10:00:00 +0000] "GET / HTTP/1.1" 404 153 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)"172.70.210.164 - - [19/Jul/2022:10:00:06 +0000] "GET /v2ray HTTP/1.1" 502 157 "-" "Go-http-client/1.1"172.70.210.164 - - [19/Jul/2022:10:00:06 +0000] "GET /v2ray HTTP/1.1" 502 157 "-" "Go-http-client/1.1"172.69.33.240 - - [19/Jul/2022:10:00:06 +0000] "GET /v2ray HTTP/1.1" 502 157 "-" "Go-http-client/1.1"[/ol]复制代码
V2Ray 服务端日志文件
[ol]2022/07/19 09:57:02 [Warning] v2ray.com/core: V2Ray 4.22.1 started[/ol]复制代码
V2Ray 客户端日志文件
[ol]// 在这里附上客户端日志配置成功[Vmess] V2Ray(v2ray***com:443)启动服务(2022/7/19 18:35:25)...V2Ray 4.42.2 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.17.1 windows/386)A unified platform for anti-**ship.2022/07/19 18:35:25 [Info] main/jsonem: Reading config: D:\Software\v2rayN-Core\config.json2022/07/19 18:35:25 [Warning] V2Ray 4.42.2 started2022/07/19 18:35:25 127.0.0.1:61280 accepted //mtalk.google.com:5228 [proxy]2022/07/19 18:35:25 127.0.0.1:61281 accepted //bl3301.storage.live.com:443 [proxy]2022/07/19 18:35:26 127.0.0.1:61286 accepted tcp:127.0.0.1:0 [api]2022/07/19 18:35:30 127.0.0.1:61292 accepted //www.google.com:443 [proxy]2022/07/19 18:35:30 127.0.0.1:61294 accepted //alive.github.com:443 [proxy]2022/07/19 18:35:35 127.0.0.1:61308 accepted //alive.github.com:443 [proxy]2022/07/19 18:35:36 [Warning] [2092548641] app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domain.com/v2ray): 502 Bad Gateway > websocket: bad handshake] > common/retry: all retry attempts failed2022/07/19 18:35:36 127.0.0.1:61311 accepted //mtalk.google.com:5228 [proxy]2022/07/19 18:35:39 [Warning] [2069622245] app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domain.com/v2ray): 502 Bad Gateway > websocket: bad handshake] > common/retry: all retry attempts failed2022/07/19 18:35:39 127.0.0.1:61321 accepted //alive.github.com:443 [proxy]2022/07/19 18:35:40 [Warning] [2041129081] app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domain.com/v2ray): 502 Bad Gateway > websocket: bad handshake] > common/retry: all retry attempts failed2022/07/19 18:35:40 127.0.0.1:61326 accepted //www.google.com:443 [proxy][/ol]复制代码 |
|