41 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

# ═══════════════════════════════════════════════════════════
# 光湖标准插座 · nginx 公共片段
# ═══════════════════════════════════════════════════════════
#
# 把本片段 include 到任何域名的 server { } 块里, 即可让该域名:
# - 通过 /__switch/* 访问本机 channel-switcher (Phase 1 只读)
# - 通过 /channel-badge/index.js 加载频道徽章前端组件
#
# 用法:
# server {
# listen 443 ssl http2;
# server_name guanghu.online;
# ...
# include /etc/nginx/snippets/zy-channel.conf;
# ...
# }
#
# 部署时把本文件 cp 到 /etc/nginx/snippets/zy-channel.conf
# ═══════════════════════════════════════════════════════════
# 切换器 API (Phase 1: list/current/manifest 只读 · Phase 2: activate)
location /__switch/ {
proxy_pass http://127.0.0.1:39000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 30s;
# 只允许 GET (Phase 1) — Phase 2 启用 activate 时改为允许 POST
limit_except GET {
deny all;
}
}
# 频道徽章公共静态资源
location /channel-badge/ {
alias /opt/guanghu/_shared/channel-badge/;
expires 1h;
add_header Cache-Control "public, max-age=3600";
}