XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
25.78k stars 3.97k forks source link

自v24.9.30版本后nginx+vless+ws组合无法监听端口或socket(当前v24.11.11问题依然存在) #4044

Closed scyphozoa203 closed 4 days ago

scyphozoa203 commented 4 days ago

完整性要求

描述

配置参考:https://github.com/XTLS/Xray-examples/tree/main/VLESS-WSS-Nginx

从v1.8.24升级后xray不监听端口或者Unix Socket,且未发现存在端口冲突等外部问题,以下命令降级后xray恢复正常。当前v24.11.11问题依旧存在

sudo bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install --version 1.8.24

以下是系统命令信息

v1.8.24

> sudo netstat --protocol=unix -nlp | grep xray
unix  2      [ ACC ]     STREAM     LISTENING     2378025  187585/xray          /tmp/xray.socket

v24.11.11(v24.9.30及以后均是如此)

> sudo netstat --protocol=unix -nlp | grep xray
(无任何输出)

操作系统:

> lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

xray服务状态:

> sudo systemctl status xray
● xray.service - Xray Service
     Loaded: loaded (/etc/systemd/system/xray.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/xray.service.d
             └─10-donot_touch_single_conf.conf
     Active: active (running) since Thu 2024-11-21 03:47:02 UTC; 10s ago
       Docs: https://github.com/xtls
   Main PID: 188766 (xray)
      Tasks: 7 (limit: 1107)
     Memory: 28.7M
        CPU: 110ms
     CGroup: /system.slice/xray.service
             └─188766 /usr/local/bin/xray run -config /usr/local/etc/xray/config.json

Nov 21 03:47:02 systemd[1]: Started xray.service - Xray Service.
Nov 21 03:47:02 xray[188766]: Xray 24.11.11 (Xray, Penetrates Everything.) 0df2446 (go1.23.3 linux/amd64)
Nov 21 03:47:02 xray[188766]: A unified platform for anti-censorship.
Nov 21 03:47:02 xray[188766]: 2024/11/21 03:47:02 [Info] infra/conf/serial: Reading config: &{Name:/usr/local/etc/xray/config.json Format:json}

我同时注意到曾经有个被关闭的Issue可能反馈了相同问题。

重现方式

仅仅需要按照文档说明从v1.8.24升级至v24.9.30及以上版本即可复现,即

sudo bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install

客户端配置

N/A

服务端配置

配置参考:https://github.com/XTLS/Xray-examples/tree/main/VLESS-WSS-Nginx

Xray:


{
  "log" : {
    "loglevel": "debug",
    "access": "/var/log/xray/access.log",
    "error": "/var/log/xray/error.log"
  },
  "inbound": {
    "listen": "/tmp/xray.socket,0666",
    "port" : "46213",
    "protocol": "vless",
    "settings": {
      "clients": [
         {
          "id": "xxx",
          "level": 0,
          "email": "xxx@yyy.com"
         }
       ],
       "decryption": "none"
    },
    "streamSettings": {
      "network": "ws",
      "wsSettings": {
        "path": "/path"
       }
    },
    "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
    },
    "allocate": {
        "strategy": "always",
        "refresh": 5,
        "concurrency": 3
      }
  },
  "outbounds": [
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "blocked",
      "protocol": "blackhole",
      "settings": {}
    }
  ],
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ],
        "outboundTag": "blocked"
      }
    ]
  }
}

Nginx: /etc/nginx/sites-enabled/xray (异常显然和nginx无关但还是附上了)


server {
    listen       80;
    server_name  xx.com;
    return 301 https://$host$request_uri;
}
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name xx.com;

    root /usr/share/nginx/html;
    index index.php index.html;
    ssl_certificate ;
    ssl_certificate_key ;
    ssl_protocols 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;
    location /path {
        if ($http_upgrade != "websocket") {
            return 404;
        }
        proxy_redirect off;
        proxy_pass http://unix:/tmp/xray.socket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout 5d;
    }
}

客户端日志

N/A

服务端日志

N/A (无任何有效信息)

access.log

(空文件)

error.log

2024/11/21 03:47:02 [Debug] app/log: Logger started
2024/11/21 03:47:02 [Warning] core: Xray 24.11.11 started
RPRX commented 4 days ago

有这种严重 bug 的话早就有人提了,大概率是你哪里弄错了