|
| 1 | +xray-ui 面板配置 reality |
| 2 | + |
| 3 | +```bash |
| 4 | +# 生成 Private key 与 Public key |
| 5 | +# 两种方案 |
| 6 | +# 1、 xray 客户端生成 amd64 arm64 |
| 7 | +/usr/local/xray-ui/bin/xray-linux-amd64 x25519 |
| 8 | +# 更新xray-ui 到最新版本 |
| 9 | + xray-ui x25519 |
| 10 | + # shortIds 生成 0 到 f,长度为 2 的倍数,长度上限为 16,或执行 openssl rand -hex 8 生成 可以为空不填 可以多行 |
| 11 | + "shortIds": [ // 客户端可用的 shortId 列表,可用于区分不同的客户端 |
| 12 | + "", // 若有此项,客户端 shortId 可为空 |
| 13 | + "a1", // 0 到 f,长度为 2 的倍数,长度上限为 16,或执行 openssl rand -hex 8 生成 |
| 14 | + "bc19", |
| 15 | + "b2da06", |
| 16 | + "2d940fe6", |
| 17 | + "b85e293fa1", |
| 18 | + "4a9f72b5c803", |
| 19 | + "19f70b462cea5d", |
| 20 | + "6ba85179e30d4fc2" |
| 21 | + ] |
| 22 | +``` |
| 23 | + |
| 24 | +dest 回源到自己nginx 服务器 用自己域名访问不会报证书问题 |
| 25 | +nginx.conf 配置 |
| 26 | + |
| 27 | +```nginx |
| 28 | +user nginx; |
| 29 | +worker_processes auto; |
| 30 | +
|
| 31 | +error_log /var/log/nginx/error.log notice; |
| 32 | +pid /var/run/nginx.pid; |
| 33 | +
|
| 34 | +events { |
| 35 | + worker_connections 1024; |
| 36 | +} |
| 37 | +
|
| 38 | +http { |
| 39 | + log_format main '[$time_local] $proxy_protocol_addr "$http_referer" "$http_user_agent"'; |
| 40 | + access_log /var/log/nginx/access.log main; |
| 41 | +
|
| 42 | + map $http_upgrade $connection_upgrade { |
| 43 | + default upgrade; |
| 44 | + "" close; |
| 45 | + } |
| 46 | +
|
| 47 | + map $proxy_protocol_addr $proxy_forwarded_elem { |
| 48 | + ~^[0-9.]+$ "for=$proxy_protocol_addr"; |
| 49 | + ~^[0-9A-Fa-f:.]+$ "for=\"[$proxy_protocol_addr]\""; |
| 50 | + default "for=unknown"; |
| 51 | + } |
| 52 | +
|
| 53 | + map $http_forwarded $proxy_add_forwarded { |
| 54 | + "~^(,[ \\t]*)*([!#$%&'*+.^_`|~0-9A-Za-z-]+=([!#$%&'*+.^_`|~0-9A-Za-z-]+|\"([\\t \\x21\\x23-\\x5B\\x5D-\\x7E\\x80-\\xFF]|\\\\[\\t \\x21-\\x7E\\x80-\\xFF])*\"))?(;([!#$%&'*+.^_`|~0-9A-Za-z-]+=([!#$%&'*+.^_`|~0-9A-Za-z-]+|\"([\\t \\x21\\x23-\\x5B\\x5D-\\x7E\\x80-\\xFF]|\\\\[\\t \\x21-\\x7E\\x80-\\xFF])*\"))?)*([ \\t]*,([ \\t]*([!#$%&'*+.^_`|~0-9A-Za-z-]+=([!#$%&'*+.^_`|~0-9A-Za-z-]+|\"([\\t \\x21\\x23-\\x5B\\x5D-\\x7E\\x80-\\xFF]|\\\\[\\t \\x21-\\x7E\\x80-\\xFF])*\"))?(;([!#$%&'*+.^_`|~0-9A-Za-z-]+=([!#$%&'*+.^_`|~0-9A-Za-z-]+|\"([\\t \\x21\\x23-\\x5B\\x5D-\\x7E\\x80-\\xFF]|\\\\[\\t \\x21-\\x7E\\x80-\\xFF])*\"))?)*)?)*$" "$http_forwarded, $proxy_forwarded_elem"; |
| 55 | + default "$proxy_forwarded_elem"; |
| 56 | + } |
| 57 | +
|
| 58 | + server { |
| 59 | + listen 80; |
| 60 | + return 301 https://$host$request_uri; |
| 61 | + } |
| 62 | +
|
| 63 | + server { |
| 64 | + #listen 127.0.0.1:8003 ssl http2 proxy_protocol; |
| 65 | + #set_real_ip_from 127.0.0.1; |
| 66 | + listen unix:/dev/shm/nginx.sock ssl http2 proxy_protocol; |
| 67 | + set_real_ip_from unix:; |
| 68 | +
|
| 69 | + ssl_certificate /etc/ssl/private/fullchain.cer; |
| 70 | + ssl_certificate_key /etc/ssl/private/private.key; |
| 71 | +
|
| 72 | + ssl_protocols TLSv1.2 TLSv1.3; |
| 73 | + ssl_ciphers TLS13_AES_128_GCM_SHA256:TLS13_AES_256_GCM_SHA384:TLS13_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305; |
| 74 | +
|
| 75 | + ssl_session_timeout 1d; |
| 76 | + ssl_session_cache shared:SSL:10m; |
| 77 | + ssl_session_tickets off; |
| 78 | +
|
| 79 | + ssl_stapling on; |
| 80 | + ssl_stapling_verify on; |
| 81 | + resolver 1.1.1.1 valid=60s; |
| 82 | + resolver_timeout 2s; |
| 83 | +
|
| 84 | + location / { |
| 85 | + sub_filter $proxy_host $host; # xray 非标准端口 改成 $proxy_host $http_host; 这样机可以域名加端口实现完整访问 |
| 86 | + sub_filter_once off; |
| 87 | +
|
| 88 | + proxy_pass https://www.lovelive-anime.jp; |
| 89 | + proxy_set_header Host $proxy_host; |
| 90 | +
|
| 91 | + proxy_http_version 1.1; |
| 92 | + proxy_cache_bypass $http_upgrade; |
| 93 | +
|
| 94 | + proxy_ssl_server_name on; |
| 95 | +
|
| 96 | + proxy_set_header Upgrade $http_upgrade; |
| 97 | + proxy_set_header Connection $connection_upgrade; |
| 98 | + proxy_set_header X-Real-IP $proxy_protocol_addr; |
| 99 | + proxy_set_header Forwarded $proxy_add_forwarded; |
| 100 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 101 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 102 | + proxy_set_header X-Forwarded-Host $host; |
| 103 | + proxy_set_header X-Forwarded-Port $server_port; |
| 104 | +
|
| 105 | + proxy_connect_timeout 60s; |
| 106 | + proxy_send_timeout 60s; |
| 107 | + proxy_read_timeout 60s; |
| 108 | +
|
| 109 | + resolver 1.1.1.1; |
| 110 | + } |
| 111 | + } |
| 112 | +} |
| 113 | +
|
| 114 | +``` |
| 115 | + |
| 116 | +面板配置示例: |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | +客户端配置 |
| 124 | + |
| 125 | +1、Clash.Meta |
| 126 | + |
| 127 | + Clash.Meta 不能对vless-h2-reality测速 |
| 128 | + |
| 129 | +```yaml |
| 130 | + |
| 131 | +proxies: |
| 132 | + - name: "vless-reality-vision" |
| 133 | + type: vless |
| 134 | + server: 127.0.0.1 |
| 135 | + port: 36712 |
| 136 | + uuid: uuid |
| 137 | + network: tcp |
| 138 | + tls: true |
| 139 | + udp: true |
| 140 | + flow: xtls-rprx-vision |
| 141 | + servername: www.lovelive-anime.jp |
| 142 | + reality-opts: |
| 143 | + public-key: publicKey |
| 144 | + short-id: shortIds |
| 145 | + |
| 146 | + - name: "vless-reality-grpc" |
| 147 | + type: vless |
| 148 | + server: 127.0.0.1 |
| 149 | + port: 51878 |
| 150 | + uuid: uuid |
| 151 | + network: grpc |
| 152 | + tls: true |
| 153 | + udp: true |
| 154 | + flow: |
| 155 | + # skip-cert-verify: true |
| 156 | + servername: www.lovelive-anime.jp |
| 157 | + grpc-opts: |
| 158 | + grpc-service-name: "path" |
| 159 | + reality-opts: |
| 160 | + public-key: publicKey |
| 161 | + short-id: shortIds |
| 162 | + |
| 163 | + - name: trojan-reality-grpc |
| 164 | + server: 127.0.0.1 |
| 165 | + port: 52310 |
| 166 | + type: trojan |
| 167 | + password: "password" |
| 168 | + network: grpc |
| 169 | + alpn: |
| 170 | + - h2 |
| 171 | + sni: www.lovelive-anime.jp |
| 172 | + flow: |
| 173 | + skip-cert-verify: false |
| 174 | + udp: true |
| 175 | + grpc-opts: |
| 176 | + grpc-service-name: "path" |
| 177 | + reality-opts: |
| 178 | + public-key: publicKey |
| 179 | + short-id: shortIds |
| 180 | + |
| 181 | +``` |
| 182 | + |
| 183 | +2 xray 原生配置参考: |
| 184 | + |
| 185 | +`https://github.com/chika0801/Xray-examples` |
0 commit comments