如何使用api 3x-ui?

问题描述 投票:0回答:1

我有自己的服务器,我在上面配置了 vless。我安装了 x3-ui 并想访问 api。官方存储库只有 nginx 的配置,我使用了它,但是当我尝试访问 api 时,出现错误“curl: (1) Unsupported HTTP version in response”

对于 Nginx(我从 3x-ui 存储库获取):

location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range; 
    proxy_redirect off;
    proxy_pass http://127.0.0.1:2053;
}

x3-ui json 配置:

{
  "log": {
    "access": "none",
    "dnsLog": false,
    "error": "",
    "loglevel": "warning",
    "maskAddress": ""
  },
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api"
      },
      {
        "type": "field",
        "outboundTag": "blocked",
        "ip": [
          "geoip:private",
          "ext:geoip_IR.dat:ir",
          "geoip:cn",
          "geoip:ru",
          "ext:geoip_VN.dat:vn",
          "geoip:es",
          "geoip:id",
          "geoip:ua",
          "geoip:tr",
          "geoip:br"
        ]
      },
      {
        "type": "field",
        "outboundTag": "blocked",
        "protocol": [
          "bittorrent"
        ]
      },
      {
        "type": "field",
        "outboundTag": "blocked",
        "domain": [
          "ext:geosite_IR.dat:malware",
          "ext:geosite_IR.dat:phishing",
          "ext:geosite_IR.dat:cryptominers",
          "ext:geosite_VN.dat:vn",
          "regexp:.*\\.vn$",
          "regexp:.*\\.cn$",
          "geosite:cn",
          "regexp:.*\\.xn--mgba3a4f16a$",
          "regexp:.*\\.ir$"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "regexp:.*\\.ru",
          "geosite:category-ru"
        ]
      }
    ]
  },
  "dns": null,
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 62789,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1"
      },
      "streamSettings": null,
      "tag": "api",
      "sniffing": null,
      "allocate": null
    },
    {
      "listen": null,
      "port": 16206,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "email": "ziigcc1i",
            "flow": "",
            "id": "d33b2c6e-b5c5-45cd-9f97-4af8690f5840"
          }
        ],
        "decryption": "none",
        "fallbacks": []
      },
      "streamSettings": {
        "network": "tcp",
        "realitySettings": {
          "dest": "yahoo.com:443",
          "maxClient": "",
          "maxTimediff": 0,
          "minClient": "",
          "privateKey": "uDbl1l7mVLvjNhpqPik3699-_QJFcp1Qoa4-KlYPt1Y",
          "serverNames": [
            "yahoo.com",
            "www.yahoo.com"
          ],
          "shortIds": [
            "658a9003",
            "1060eeeba0",
            "dcf27c8af061",
            "7aaa",
            "0d7cae",
            "1cb14e7e20c3acf7",
            "1e",
            "7549f51728d9cc"
          ],
          "show": false,
          "xver": 0
        },
        "security": "reality",
        "tcpSettings": {
          "acceptProxyProtocol": false,
          "header": {
            "type": "none"
          }
        }
      },
      "tag": "inbound-16206",
      "sniffing": {
        "enabled": false,
        "destOverride": [
          "http",
          "tls",
          "quic",
          "fakedns"
        ],
        "metadataOnly": false,
        "routeOnly": false
      },
      "allocate": {
        "strategy": "always",
        "refresh": 5,
        "concurrency": 3
      }
    }
  ],
  "outbounds": [
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIP",
        "redirect": "",
        "noises": []
      }
    },
    {
      "tag": "blocked",
      "protocol": "blackhole",
      "settings": {}
    }
  ],
  "transport": null,
  "policy": {
    "levels": {
      "0": {
        "statsUserDownlink": true,
        "statsUserUplink": true
      }
    },
    "system": {
      "statsInboundDownlink": true,
      "statsInboundUplink": true,
      "statsOutboundDownlink": true,
      "statsOutboundUplink": true
    }
  },
  "api": {
    "tag": "api",
    "services": [
      "HandlerService",
      "LoggerService",
      "StatsService"
    ]
  },
  "stats": {},
  "reverse": null,
  "fakedns": null,
  "observatory": null,
  "burstObservatory": null
}
nginx vpn
1个回答
0
投票

禁用嵌入式 tls(删除 Web 面板的任何证书路径) 将监听 ip/host 设置为 127.0.0.1/localhost 检查 Web 面板的监听端口 (2053),从本地主机 ping 它

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.