63 lines
2.1 KiB
Plaintext
63 lines
2.1 KiB
Plaintext
|
|
# =============================================================================
|
|||
|
|
# MeshSafe Nginx 反向代理(内网 HTTP 明文)
|
|||
|
|
# =============================================================================
|
|||
|
|
#
|
|||
|
|
# 外部端口:44380(compose 映射 44380:80)
|
|||
|
|
# 上游:api:8443(docker 网络内服务名)
|
|||
|
|
# 无 TLS —— 光闸内网场景,外层防护靠光闸本身
|
|||
|
|
#
|
|||
|
|
# 访问路径:
|
|||
|
|
# http://<内网服务器IP>:44380/console/login → 控制台
|
|||
|
|
# http://<内网服务器IP>:44380/api/v1/scans → 扫描 API
|
|||
|
|
# http://<内网服务器IP>:44380/api/v1/health → 健康检查
|
|||
|
|
# =============================================================================
|
|||
|
|
|
|||
|
|
server {
|
|||
|
|
listen 80;
|
|||
|
|
server_name _;
|
|||
|
|
|
|||
|
|
# ---- 根路径 → 自动跳转到控制台登录页(保留原始 host + port)----
|
|||
|
|
location = / {
|
|||
|
|
return 302 $scheme://$http_host/console/login;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# 光闸可能传大文件(ISO 镜像 / 大压缩包)
|
|||
|
|
client_max_body_size 500M;
|
|||
|
|
client_body_timeout 600s;
|
|||
|
|
client_header_timeout 60s;
|
|||
|
|
send_timeout 600s;
|
|||
|
|
|
|||
|
|
# ---- 控制台 ----
|
|||
|
|
location /console/ {
|
|||
|
|
proxy_pass http://api:8443;
|
|||
|
|
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 300s;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ---- 扫描 API ----
|
|||
|
|
location /api/ {
|
|||
|
|
proxy_pass http://api:8443;
|
|||
|
|
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 300s;
|
|||
|
|
proxy_send_timeout 300s;
|
|||
|
|
proxy_request_buffering off; # 大文件流式转发,不在 Nginx 缓冲
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ---- 健康检查(关 access_log 减少日志噪音)----
|
|||
|
|
location = /health {
|
|||
|
|
proxy_pass http://api:8443/api/v1/health;
|
|||
|
|
access_log off;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# ---- 静态资源(logo、CSS 等)----
|
|||
|
|
location /static/ {
|
|||
|
|
proxy_pass http://api:8443/static/;
|
|||
|
|
expires 7d;
|
|||
|
|
access_log off;
|
|||
|
|
}
|
|||
|
|
}
|