引言
配置哪吒监控的Nginx反向代理
如何安装哪吒监控请查看 教程
配置过程
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name monitor.demonland.top;
ssl_certificate /etc/nginx/conf.d/cert/monitor/monitor.demonland.top_chain.pem; # 域名证书路径
ssl_certificate_key /etc/nginx/conf.d/cert/monitor/monitor.demonland.top_key.key; # 域名私钥路径
ssl_stapling on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m; # 如果与其他配置冲突,请注释此项
ssl_protocols TLSv1.2 TLSv1.3;
underscores_in_headers on;
keepalive_time 24h;
keepalive_requests 100000;
keepalive_timeout 120s;
#set_real_ip_from 0.0.0.0/0; # 替换为你的 CDN 回源 IP 地址段
#real_ip_header CF-Connecting-IP;
# grpc 相关
location ^~ /proto.NezhaService/ {
grpc_read_timeout 300s;
grpc_send_timeout 300s;
grpc_socket_keepalive on;
grpc_pass grpc://grpcservers;
access_log off;
}
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 nz-realip $remote_addr; #如果你使用nginx作为最外层,就把上面一行注释掉,启用此行
proxy_set_header Origin https://$host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_pass http://172.32.100.9:8008;
}
location / {
proxy_set_header Host $host;
#proxy_set_header nz-realip $http_cf_connecting_ip; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
proxy_set_header nz-realip $remote_addr; # 如果你使用nginx作为最外层,就把上面一行注释掉,启用此行
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_set_header X-Forwarded-Proto $scheme; # 如果你使用nginx作为最外层,就启用此行避免无法正确读取访问的协议
proxy_pass http://172.32.100.9:8008;
}
}
upstream grpcservers {
server 172.32.100.9:8008; # 如果有多个可以定义多次
keepalive 1800; # 保持长连接的秒数。如果不配置这个参数,Nginx 与你的服务之间的连接,大概率会是短连接而不是长连接。
}
评论 (0)