{ # 全局选项 auto_https off admin off log { level info output stdout } } # 如果 DOMAIN 为空,直接走 80 端口 HTTP(自签证书后面再补) # 如果有域名,改用下面的 https 配置块 http://{$DOMAIN:NEWS_DOMAIN_FALLBACK} { # /api/* 直接转发,保留路径(后端 FastAPI 路由就是 /api/v1/*) reverse_proxy /api/* api:8000 # 其余走前端 SPA reverse_proxy /* frontend:80 encode gzip zstd # 日志 log { output stdout format console } } # 如果有域名,启用自动 HTTPS(取消下面注释,并把上面块注释) # {$DOMAIN} { # reverse_proxy /api/* api:8000 # reverse_proxy /* frontend:80 # encode gzip zstd # }