Files
lzwlab_cn/lzwlab.status.nginx.conf
T

68 lines
2.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Komari Lite 服务器监控:https://status.lzwlab.cn/
# 反代本机 127.0.0.1:25774Docker 容器 komari,镜像 ghcr.io/nuomiiiii/komari
# 注意:Komari Lite 是 nuomiiiii/komari 分支,不是上游 komari-monitor/komari
# 参考 https://lite.komari.wiki/guide/start 与 https://lite.komari.wiki/security/reverse-proxy
# HTTP:仅用于 certbot http-01 挑战,其余 301 到 HTTPS
server {
listen 80;
listen [::]:80;
server_name status.lzwlab.cn;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# 注意:301 必须放在 location / 内,server 级 return 会在 location 匹配前执行,
# 导致 ACME 挑战路径也被重定向(踩坑记录见 setup.md)
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name status.lzwlab.cn;
# 由 certbot 为 status.lzwlab.cn 签发(DNS 解析生效后执行 certbot
ssl_certificate /etc/letsencrypt/live/status.lzwlab.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/status.lzwlab.cn/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
location / {
# HEAD 探测直接返回 204,避免被代理策略误判
if ($request_method = HEAD) {
return 204;
}
proxy_pass http://127.0.0.1:25774;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
# WebSocket(远程终端/实时数据)必须保留 Upgrade 头
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 禁用代理缓冲,实时数据即时推送
proxy_buffering off;
proxy_request_buffering off;
client_max_body_size 50M;
}
# Agent RPC2:独立长连接超时与 Origin,避免状态连接被普通页面策略提前断开
location ^~ /api/rpc2 {
proxy_pass http://127.0.0.1:25774;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Origin $scheme://$http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_buffering off;
}
}