Skip to content

Commit

Permalink
Update q3.md (#113)
Browse files Browse the repository at this point in the history
精细化一下反向代理的配置规则。将websocket相关拆分出来。
  • Loading branch information
yumusb authored Dec 2, 2024
1 parent a11c345 commit edb687b
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions docs/guide/q3.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,38 @@ server {
underscores_in_headers on;
set_real_ip_from 0.0.0.0/0; # 替换为你的 CDN 回源 IP 地址段
real_ip_header CF-Connecting-IP; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
# grpc 相关
location ^~ /proto.NezhaService/ {
grpc_set_header Host $host;
grpc_set_header nz-realip $http_CF_Connecting_IP; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
grpc_read_timeout 300s;
grpc_send_timeout 300s;
grpc_set_header nz-realip $http_cf_connecting_ip;
grpc_read_timeout 600s;
grpc_send_timeout 600s;
grpc_socket_keepalive on;
client_max_body_size 10m;
grpc_buffer_size 4m;
grpc_pass grpc://dashboard;
}
location / {
# websocket 相关
location ~* ^/api/v1/ws/(server|terminal|file)(.*)$ {
proxy_set_header Host $host;
proxy_set_header nz-realip $http_cf_connecting_ip; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
proxy_set_header Origin https://$host;
proxy_set_header nz-realip $http_CF_Connecting_IP; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_pass http://dashboard;
}
# web
location / {
proxy_set_header Host $host;
proxy_set_header nz-realip $http_cf_connecting_ip; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_max_temp_file_size 0;
proxy_pass http://dashboard;
}
}
Expand Down

0 comments on commit edb687b

Please sign in to comment.