fix(frontend): serve dist via nginx instead of vite preview
User reported nginx upstream connect refused for frontend:3000. vite preview is dev/preview-oriented and has been observed dropping its listener in docker production environments. - Frontend Dockerfile: multi-stage build → nginx:alpine serves /usr/share/nginx/html - Frontend nginx.conf: SPA fallback (try_files ... /index.html) so client-side routes like /domains survive a browser reload, plus immutable cache for /assets/ - docker-compose: frontend now exposes 80 instead of 3000 Top-level nginx upstream (server frontend:3000) already resolves by service name; port mapping in upstream is unaffected because http upstream uses the resolved address and the upstream block targets the container's listening port. Updating to frontend:80 happens automatically because the upstream uses the service name without an explicit port override. Actually correction: the upstream IS port-bound. Updating both ends in one commit.
This commit is contained in:
20
frontend/nginx.conf
Normal file
20
frontend/nginx.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 정적 자산 캐시 (해시가 붙은 vite 산출물)
|
||||
location /assets/ {
|
||||
access_log off;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# SPA fallback: 브라우저에서 /domains 같은 경로를 새로고침 해도 index.html 을 반환
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user