xray实现代理

2026-02-01 22:49

在vps中安装xui面板

bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)

面板启动

  • 启动/停止服务x-ui start / x-ui stop

  • 查看状态与日志x-ui status / x-ui log

3. 配置代理节点
这是 X-UI 的核心功能。进入「入站列表」→「添加入站」

  • 协议:选择 VMess、VLESS、Trojan 或 Shadowsocks 等

  • 端口:设置一个外部端口(需在防火墙放行)。

  • 传输方式:根据需求选择,例如 WebSocket (WS) 常用于提升连接的隐蔽性
    配置完成后保存,即可生成用于客户端连接的配置信息或订阅链接。


以vmess 为例


image.png

image.png



image.png

image.png



windows客户端可以用 v2rayN

image.png

下载地址  https://github.com/2dust/v2rayN


linux可以使用xray-core

下载地址 https://github.com/XTLS/Xray-core/releases

配置文件实例

{
  "inbounds": [
    {
      "port": 10808, //本地系统代理端口
      "listen": "127.0.0.1",//本机ip
      "protocol": "http", // 协议http 或 socks5
      "settings": {
        "auth": "noauth",
        "udp": false
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "serverIp", //开启了x-ui的服务器ip
            "port": 47293, // 开启了x-ui的服务器端口号
            "users": [
              {
                "id": "入站列表uuid", //x-ui创建时候自动生成 
                "alterId": 0,
                "security": "auto"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "tls",
        "tlsSettings": {
          "serverName": "serverdomain" //tls代理域名
        },
        "tcpSettings": {
          "header": {
            "type": "http",
            "request": {
              "path": ["/"],
              "headers": {
                "Host": ["serverdomain"]
              }
            }
          }
        }
      }
    }
  ]
}