chika0801 / Xray-examples

Xray 配置示例
https://github.com/XTLS/Xray-core
431 stars 86 forks source link

VLESS HTTP2 Nginx #21

Closed bart3nder closed 6 months ago

bart3nder commented 6 months ago

Hi! Happy new year! Can you provide an example of using Vless with H2 transport behind nginx server? I tried to build something myself by it didnt work and I didnt find example anywhere. My Nginx config:

            #Vless TLS HTTP2 CDN Nginx
            location /examplepath {
                proxy_redirect off;
                proxy_pass http://127.0.0.1:833;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host;
            }

My Xray config:

        {
            "tag": "VLESS-H2",
            "listen": "127.0.0.1",
            "port": 833,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "d9d7005c-f037-4852-8690-6879c520b8a4",  //UUID
                        "level": 0,
                        "email": "general@vless-http2"
                    }
                ],
                "decryption": "none"
            },
            "streamSettings": {
                "network": "h2",
                "httpSettings": { 
                 "path": "/examplepath" 
                },
                "security": "none"
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ]
            }
        },
chika0801 commented 6 months ago

https://github.com/lxhao61/integrated-examples/tree/main/V2Ray(VLESS%2BH2C)%2BCaddy

https://github.com/XTLS/Xray-examples/blob/main/VLESS-H2C-Caddy2/Caddyfile

I looked up a message that only CADDY listens to 443 and passes H2C to the backend Xray in this form.

I don't know much about NGINX configuration, and I'm not sure if the current NGINX version can implement NGINX listening to 443 and passing H2C to the backend in the form of XRAY.