vmess+tcp+tls+nginx分流(nginx的配置有问题)
nginx在代理tcp流量有问题
首先下载Xray的linux版本,解压编辑config.json
config.json{ "inbounds": [ { "port": 54321, "listen": "127.0.0.1", "protocol": "vmess", "settings": { "clients": [ { "id": "你的UUID", "alterId": 0 } ] }, "streamSettings": { "network": "tcp", "security": "none" } } ], "outbounds": [ { "protocol": "freedom", "settings": {} } ] }
提示
-c 可以指定config.json文件
{ "log": { "access": "", "error": "", "loglevel": "warning" }, "inbounds": [ { "tag": "socks", "port": 10808, "listen": "127.0.0.1", "protocol": "socks", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ], "routeOnly": false }, "settings": { "auth": "noauth", "udp": true, "allowTransparent": false } }, { "tag": "http", "port": 10809, "listen": "127.0.0.1", "protocol": "http", "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ], "routeOnly": false }, "settings": { "auth": "noauth", "udp": true, "allowTransparent": false } } ], "outbounds": [ { "tag": "proxy", "protocol": "vmess", "settings": { "vnext": [ { "address": "yourdomain", "port": 54321, "users": [ { "id": "你的UUID", "alterId": 0, "email": "t@t.tt", "security": "auto" } ] } ] }, "streamSettings": { "network": "tcp", "security": "tls", "tlsSettings": { "allowInsecure": false } }, "mux": { "enabled": false, "concurrency": -1 } }, { "tag": "direct", "protocol": "freedom", "settings": {} }, { "tag": "block", "protocol": "blackhole", "settings": { "response": { "type": "http" } } } ], "dns": { "hosts": { "dns.google": "8.8.8.8", "proxy.example.com": "127.0.0.1" }, "servers": [ { "address": "223.5.5.5", "domains": [ "panyin.xyz" ] }, { "address": "223.5.5.5", "domains": [ "geosite:cn", "geosite:geolocation-cn" ], "expectIPs": [ "geoip:cn" ] }, "1.1.1.1", "8.8.8.8", "https://dns.google/dns-query" ] }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "inboundTag": [ "api" ], "outboundTag": "api" }, { "type": "field", "port": "443", "network": "udp", "outboundTag": "block" }, { "type": "field", "port": "0-65535", "outboundTag": "proxy" } ] } }
#vmess的tcp的https加密(暂无) server { listen 443 ssl; server_name yourdomain.com; ssl_certificate /etc/nginx/ssl/fullchain.pem; ssl_certificate_key /etc/nginx/ssl/privkey.pem; location / { proxy_redirect off; proxy_pass http://127.0.0.1:12345; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; } }
nginx还可以建立多个location实现流量分流
注
注意server_name domain.com指的是要放行的域名