:80 { # 根目录指向构建产物 root * /app # 关闭访问日志 log { output discard } # 启用压缩 encode gzip zstd # 文件服务器配置 try_files {path} {path}.html {path}/ file_server # 错误页面处理 handle_errors { @404 { expression {http.error.status_code} == 404 } @403 { expression {http.error.status_code} == 403 } rewrite @404 /404.html rewrite @403 /404.html file_server } # 静态资源缓存配置 @assets { path /assets/* } header @assets { Cache-Control "public, immutable, max-age=31536000" } }