xray+ws+tls+nginx

xray+ws+tls+nginx

VLESS 是一个无状态的轻量传输协议,与 VMess 不同,VLESS 不依赖于系统时间,认证方式同样为 UUID,但不需要 alterId。

其中xray使用官方的安装脚本安装即可:

官方安装脚本地址:https://github.com/XTLS/Xray-install

和v2ray的配置方法基本一致

config文件的路径是:

/usr/local/etc/xray/config.json

配置写法如下,一定完全照这个来,我当时自己写了好久,一直启动不了,不知道是啥原因

config.json

{
    "log": {
    "loglevel": "warning"
    },
    "inbounds":  [{
        "port":  22332,
        "listen":   "127.0.0.1",
        "protocol":   "vless",
        "settings":  {
            "clients":  [{
            "id":   "",
            "level": 0,
            "email": "[email protected]"
            }],
    "decryption": "none"
    },
    "streamSettings":  {
        "network":  "ws",
        "security": "none",
        "wsSettings":  {
            "path":   "/data" }
        }
    }],
    "outbounds":  [{
        "protocol":   "freedom",
        "settings":  {}
    }]
}

nginx那里你在你的443 port那个server里加一个location,引流到xray这个22332端口即可

例如:

server {
        listen 443 ssl http2;
        listen [::]:443 http2;
        ssl on;
        ssl_certificate       /usr/local/etc/xray/xray.crt;
        ssl_certificate_key   /usr/local/etc/xray/xray.key;
        ssl_protocols         TLSv1.3;
        ssl_ciphers           TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5;
        server_name 1.1.1.1 test.com; # substitute your

    location /data { # 与 V2Ray 配置中的 path 保持一致
                proxy_redirect off;
                proxy_pass http://127.0.0.1:22332;#假设WebSocket监听在环回地址的10000端口上
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $http_host;

                # Show realip in v2ray access.log
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    charset     utf-8;

    # max upload size
    client_max_body_size 30M;   # adjust to taste

    location /static
    {
        alias /root/web/static/; # 指向django的static目录
    }

    # Finally, send all non-media requests to the Django server.
    location /
    {
        uwsgi_pass  django;
        include     uwsgi_params; # the uwsgi_params file you installed
    }
}
文章目录