v2ray / discussion

For general discussion over Project V development and usage.
299 stars 34 forks source link

nginx分流时提示404 Not Found #816

Closed deximy closed 4 years ago

deximy commented 4 years ago

除非特殊情况,请完整填写所有问题。不按模板发的 issue 将直接被关闭。 如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用Discussion进行讨论。

1) 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明) 4.27 2) 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。 使用 Chrome 通过VMess代理观看 YouTube 视频。 3) 你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等) 无法正常使用,打开网页提示ERR_CONNECTION_CLOSED 4) 你期待看到的正确表现是怎样的? 正常打开网页 5) 请附上你的配置(提交 Issue 前请隐藏服务器端IP地址)。

服务器端配置:

{
      "tag": "proxy",
      "listen": "127.0.0.1",
      "port": 5654,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "*",
            "alterId": 16
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "sniffing": {
          "enabled": true,
          "destOverride": [
            "http",
            "tls"
          ]
        }
      }
    }

客户端配置:

{
  "inbounds": [
    {
      "port": 2080,
      "listen": "127.0.0.1",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "auth": "noauth",
        "udp": false
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "*",
            "port": 4430,
            "users": [
              {
                "id": "*",
                "alterId": 16
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "wsSettings": {
          "path": "/fxxkgfw"
        }
      }
    }
  ]
}

6) 请附上出错时软件输出的错误日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

服务器端错误日志:

2020/08/23 01:49:49 [Debug] v2ray.com/core/app/log: Logger closing
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/log: Logger started
2020/08/23 01:49:50 [Info] v2ray.com/core/app/dns: DNS: created Local DOH client for https://cloudflare-dns.com/dns-query
2020/08/23 01:49:50 [Info] v2ray.com/core/app/dns: DNS: created udp client inited for 1.1.1.1:53
2020/08/23 01:49:50 [Info] v2ray.com/core/app/dns: DNS: created udp client inited for 1.0.0.1:53
2020/08/23 01:49:50 [Info] v2ray.com/core/app/dns: DNS: created udp client inited for 8.8.8.8:53
2020/08/23 01:49:50 [Info] v2ray.com/core/app/dns: DNS: created udp client inited for 8.8.4.4:53
2020/08/23 01:49:50 [Info] v2ray.com/core/app/dns: DNS: created localhost client
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>api>>>traffic>>>uplink
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>api>>>traffic>>>downlink
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/proxyman/inbound: creating stream worker on 0.0.0.0:10086
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>proxy>>>traffic>>>uplink
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>proxy>>>traffic>>>downlink
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/proxyman/inbound: creating stream worker on 127.0.0.1:5654
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>domestic>>>traffic>>>uplink
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>domestic>>>traffic>>>downlink
2020/08/23 01:49:50 [Debug] v2ray.com/core/app/proxyman/inbound: creating stream worker on 0.0.0.0:53
2020/08/23 01:49:50 [Info] v2ray.com/core/transport/internet/tcp: listening TCP on 0.0.0.0:10086
2020/08/23 01:49:50 [Info] v2ray.com/core/transport/internet/udp: listening UDP on 0.0.0.0:53
2020/08/23 01:49:50 [Info] v2ray.com/core/transport/internet/kcp: listening on 0.0.0.0:53
2020/08/23 01:49:50 [Warning] v2ray.com/core: V2Ray 4.27.0 started

客户端错误日志:

2020/08/23 10:00:25 [Debug] v2ray.com/core/app/log: Logger started
2020/08/23 10:00:25 [Debug] v2ray.com/core/app/proxyman/inbound: creating stream worker on 127.0.0.1:2080
2020/08/23 10:00:25 [Info] v2ray.com/core/transport/internet/tcp: listening TCP on 127.0.0.1:2080
2020/08/23 10:00:25 [Warning] v2ray.com/core: V2Ray 4.27.0 started
2020/08/23 10:00:30 [Info] [869245664] v2ray.com/core/proxy/socks: TCP Connect request to tcp:www.baidu.com:443
2020/08/23 10:00:30 [Info] [2615697636] v2ray.com/core/proxy/socks: TCP Connect request to tcp:www.baidu.com:443
2020/08/23 10:00:30 [Info] [869245664] v2ray.com/core/app/dispatcher: sniffed domain: www.baidu.com
2020/08/23 10:00:30 [Info] [869245664] v2ray.com/core/app/dispatcher: default route for tcp:www.baidu.com:443
2020/08/23 10:00:30 [Info] [869245664] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:30 [Info] [2615697636] v2ray.com/core/app/dispatcher: sniffed domain: www.baidu.com
2020/08/23 10:00:30 [Info] [2615697636] v2ray.com/core/app/dispatcher: default route for tcp:www.baidu.com:443
2020/08/23 10:00:30 [Info] [2615697636] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:30 [Info] [869245664] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:30 [Info] [2615697636] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:31 [Info] [869245664] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:31 [Info] [2615697636] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:31 [Info] [869245664] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:31 [Info] [2615697636] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:32 [Info] [869245664] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:32 [Info] [2615697636] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:33 [Warning] [869245664] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://*:4430/fxxkgfw): 404 Not Found > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2020/08/23 10:00:33 [Info] [869245664] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2020/08/23 10:00:33 [Info] [4236152230] v2ray.com/core/proxy/socks: TCP Connect request to tcp:www.baidu.com:443
2020/08/23 10:00:33 [Info] [4236152230] v2ray.com/core/app/dispatcher: sniffed domain: www.baidu.com
2020/08/23 10:00:33 [Info] [4236152230] v2ray.com/core/app/dispatcher: default route for tcp:www.baidu.com:443
2020/08/23 10:00:33 [Info] [4236152230] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:33 [Warning] [2615697636] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://*:4430/fxxkgfw): 404 Not Found > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2020/08/23 10:00:33 [Info] [2615697636] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2020/08/23 10:00:33 [Info] [1125087147] v2ray.com/core/proxy/socks: TCP Connect request to tcp:www.baidu.com:443
2020/08/23 10:00:33 [Info] [1125087147] v2ray.com/core/app/dispatcher: sniffed domain: www.baidu.com
2020/08/23 10:00:33 [Info] [1125087147] v2ray.com/core/app/dispatcher: default route for tcp:www.baidu.com:443
2020/08/23 10:00:33 [Info] [1125087147] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:33 [Info] [4236152230] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:33 [Info] [1125087147] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:33 [Info] [4236152230] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:33 [Info] [1125087147] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:34 [Info] [4236152230] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:34 [Info] [1125087147] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:35 [Info] [4236152230] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:35 [Info] [1125087147] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:35 [Warning] [4236152230] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://*:4430/fxxkgfw): 404 Not Found > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2020/08/23 10:00:35 [Info] [4236152230] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2020/08/23 10:00:36 [Warning] [1125087147] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://*:4430/fxxkgfw): 404 Not Found > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2020/08/23 10:00:36 [Info] [1125087147] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2020/08/23 10:00:37 [Info] [2587029436] v2ray.com/core/proxy/socks: TCP Connect request to tcp:message.bilibili.com:443
2020/08/23 10:00:37 [Info] [2587029436] v2ray.com/core/app/dispatcher: sniffed domain: message.bilibili.com
2020/08/23 10:00:37 [Info] [2587029436] v2ray.com/core/app/dispatcher: default route for tcp:message.bilibili.com:443
2020/08/23 10:00:37 [Info] [2587029436] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:37 [Info] [2587029436] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:38 [Info] [4154861066] v2ray.com/core/proxy/socks: TCP Connect request to tcp:api.vc.bilibili.com:443
2020/08/23 10:00:38 [Info] [4154861066] v2ray.com/core/app/dispatcher: sniffed domain: api.vc.bilibili.com
2020/08/23 10:00:38 [Info] [4154861066] v2ray.com/core/app/dispatcher: default route for tcp:api.vc.bilibili.com:443
2020/08/23 10:00:38 [Info] [4154861066] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:38 [Info] [2587029436] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:38 [Info] [4154861066] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:38 [Info] [4154861066] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:38 [Info] [2587029436] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:39 [Info] [4154861066] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:39 [Info] [2587029436] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:39 [Info] [4154861066] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:40 [Warning] [2587029436] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://*:4430/fxxkgfw): 404 Not Found > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2020/08/23 10:00:40 [Info] [2587029436] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2020/08/23 10:00:40 [Info] [858315251] v2ray.com/core/proxy/socks: TCP Connect request to tcp:message.bilibili.com:443
2020/08/23 10:00:40 [Info] [858315251] v2ray.com/core/app/dispatcher: sniffed domain: message.bilibili.com
2020/08/23 10:00:40 [Info] [858315251] v2ray.com/core/app/dispatcher: default route for tcp:message.bilibili.com:443
2020/08/23 10:00:40 [Info] [858315251] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:40 [Info] [858315251] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:40 [Warning] [4154861066] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/vmess/outbound: failed to find an available destination > v2ray.com/core/common/retry: [v2ray.com/core/transport/internet/websocket: failed to dial WebSocket > v2ray.com/core/transport/internet/websocket: failed to dial to (wss://*:4430/fxxkgfw): 404 Not Found > websocket: bad handshake] > v2ray.com/core/common/retry: all retry attempts failed
2020/08/23 10:00:40 [Info] [4154861066] v2ray.com/core/app/proxyman/inbound: connection ends > v2ray.com/core/proxy/socks: connection ends > v2ray.com/core/proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2020/08/23 10:00:40 [Info] [3627753077] v2ray.com/core/proxy/socks: TCP Connect request to tcp:api.vc.bilibili.com:443
2020/08/23 10:00:40 [Info] [3627753077] v2ray.com/core/app/dispatcher: sniffed domain: api.vc.bilibili.com
2020/08/23 10:00:40 [Info] [3627753077] v2ray.com/core/app/dispatcher: default route for tcp:api.vc.bilibili.com:443
2020/08/23 10:00:40 [Info] [3627753077] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:40 [Info] [858315251] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:40 [Info] [3627753077] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:41 [Info] [3627753077] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:41 [Info] [858315251] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:41 [Info] [3627753077] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:42 [Info] [858315251] v2ray.com/core/transport/internet/websocket: creating connection to tcp:*:4430
2020/08/23 10:00:42 [Debug] v2ray.com/core/app/log: Logger closing

7) 请附上访问日志。在 Linux 中,日志通常在 /var/log/v2ray/access.log 文件中。 访问日志是空的。

8) 其它相关的配置文件(如 Nginx)和相关日志。 Nginx配置文件:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name *;

    ssl_certificate       /etc/nginx/ssl/deximy.cer;
    ssl_certificate_key   /etc/nginx/ssl/deximy.key;

    root /home;
    index index.html;

    access_log /home/access.log;
    error_log  /home/error.log;

    location /fxxkgfw {
        proxy_redirect off;
        proxy_pass http://127.0.0.1:5654;
        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;
    }
}

Nginx日志:

* - - [23/Aug/2020:01:59:57 +0000] "GET /fxxkgfw HTTP/1.1" 404 0 "-" "Go-http-client/1.1"
* - - [23/Aug/2020:01:59:57 +0000] "GET /fxxkgfw HTTP/1.1" 404 0 "-" "Go-http-client/1.1"
* - - [23/Aug/2020:01:59:57 +0000] "GET /fxxkgfw HTTP/1.1" 404 0 "-" "Go-http-client/1.1"
* - - [23/Aug/2020:01:59:57 +0000] "GET /fxxkgfw HTTP/1.1" 404 0 "-" "Go-http-client/1.1"
* - - [23/Aug/2020:01:59:58 +0000] "GET /fxxkgfw HTTP/1.1" 404 0 "-" "Go-http-client/1.1"

nginx和v2都运行在docker里,docker监听4430并映射到容器443端口

9) 如果 V2Ray 无法启动,请附上 --test 输出。

通常的命令为 /usr/bin/v2ray/v2ray --test --config /etc/v2ray/config.json。请按实际情况修改。

10) 如果 V2Ray 服务运行不正常,请附上 journal 日志。

通常的命令为 journalctl -u v2ray

请预览一下你填的内容再提交。

rikkix commented 4 years ago

Client:

"port": 4430,  
"port": 443,
deximy commented 4 years ago

Client:

"port": 4430,  
"port": 443,

docker把4430映射到容器的443了,nginx和v2ray都运行在docker里,宿主机443不通

deximy commented 4 years ago

fix了。服务端忘记写wsSettings了。换用新版本nginx之后报了502就很容易查到问题了。