컨테이너 재생성 시 502 Bad Gateway 방지: - 모든 nginx proxy_pass를 set $upstream 변수 방식으로 전환 (9개 파일, 24개 location) - resolver 127.0.0.11 valid=10s ipv6=off 통합 선언 - ai-api location의 개별 resolver 8.8.8.8 제거 (server-level로 통합) - 10개 API 서비스에 healthcheck 추가 (Node: wget, Python: urllib) - 모든 web/gateway depends_on을 condition: service_healthy로 강화 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
1.9 KiB
Nginx Configuration File
64 lines
1.9 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
resolver 127.0.0.11 valid=10s ipv6=off;
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# 대시보드 (로그인 포함)
|
|
location = /dashboard {
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
add_header Pragma "no-cache";
|
|
try_files /dashboard.html =404;
|
|
}
|
|
|
|
location = / {
|
|
return 302 /dashboard$is_args$args;
|
|
}
|
|
|
|
# 레거시 /login → /dashboard 리다이렉트
|
|
location = /login {
|
|
return 302 /dashboard$is_args$args;
|
|
}
|
|
|
|
# 공유 JS (notification-bell.js, nav-header.js)
|
|
location /shared/ {
|
|
alias /usr/share/nginx/html/shared/;
|
|
expires 1h;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
|
|
# SSO Auth 프록시
|
|
location /auth/ {
|
|
set $upstream http://sso-auth:3000;
|
|
rewrite ^/auth/(.*)$ /api/auth/$1 break;
|
|
proxy_pass $upstream;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# System1 API 프록시 (대시보드 배너용: 알림/TBM/휴가 카운트)
|
|
location /api/ {
|
|
set $upstream http://system1-api:3005;
|
|
proxy_pass $upstream$request_uri;
|
|
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_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
# Health check
|
|
location /health {
|
|
access_log off;
|
|
return 200 '{"status":"ok","service":"gateway"}';
|
|
add_header Content-Type application/json;
|
|
}
|
|
}
|