fix(security): 收紧默认部署暴露面
Test deployment public URL (Linux) / test-linux (push) Canceled after 0s
Test start.ps1 (Windows) / test-windows (push) Canceled after 0s

This commit is contained in:
2026-09-12 21:56:37 +08:00
parent 40732c011b
commit f4e7b9b461
9 changed files with 504 additions and 115 deletions
+25 -9
View File
@@ -9,7 +9,8 @@ map $http_host $easyai_forwarded_host {
'' $host;
}
# www 域名重定向,使用二级域名注释掉此部分的域名重定向
# EASYAI_WWW_REDIRECT_BEGIN
# www 域名重定向;IP 模式生成配置时会删除整个区块。
server {
listen 80;
listen [::]:80;
@@ -32,6 +33,7 @@ server {
return 301 https://51easyai.com$request_uri;
}
}
# EASYAI_WWW_REDIRECT_END
server {
listen 80;
@@ -104,6 +106,20 @@ server {
return 404;
}
# 废弃的服务端任意 HTTP 调试入口不得对公网开放。
location = /api/integration/platform-api/execute {
return 404;
}
# 旧教育平台 SSO 必须先配置双方独立密钥,默认不对公网开放。
location = /api/auth/sign/token {
return 404;
}
location = /api/auth/verify/token {
return 404;
}
location /api/ {
proxy_pass http://127.0.0.1:3001/;
proxy_read_timeout 1200s; # 您已设置,适合长连接
@@ -160,14 +176,14 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
}
location /logs-web/ {
proxy_pass http://127.0.0.1:8080/logs-web/;
proxy_redirect off;
proxy_set_header X-Original-Prefix '/logs-web';
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_set_header Host $host;
# Dozzle 直接暴露会泄露全部容器日志、环境与下载入口。
# 如需排障,请通过服务器本机或 SSH 隧道访问回环端口,不允许公网代理。
location = /logs-web {
return 404;
}
location ^~ /logs-web/ {
return 404;
}
location = /jupyterlab {
return 404;