events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; # 로그 설정 access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # 업로드 크기 제한 client_max_body_size 10M; server { listen 80; server_name localhost; # 프론트엔드 파일 서빙 location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ /index.html; } # API 프록시 location /api/ { proxy_pass http://backend:8000/api/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; 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; proxy_cache_bypass $http_upgrade; } # 업로드된 파일 서빙 location /uploads/ { alias /usr/share/nginx/html/uploads/; expires 1y; add_header Cache-Control "public, immutable"; } } }