36 lines
1.1 KiB
Nginx Configuration File
36 lines
1.1 KiB
Nginx Configuration File
# Frontend nginx config
|
|
# - Serves the built SPA from /usr/share/nginx/html
|
|
# - Proxies /api/* to the backend service (Docker compose network name: api)
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# حداکثر حجم فایلهای آپلودی (فاکتور/پیشفاکتور) — پیشفرض nginx فقط ۱ مگابایت
|
|
# است و آپلودهای بزرگتر با خطای 413 رد میشوند.
|
|
client_max_body_size 50m;
|
|
|
|
# API reverse proxy -> FastAPI backend (port 8000)
|
|
location /api/ {
|
|
proxy_pass http://api:8000;
|
|
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;
|
|
}
|
|
|
|
# SPA fallback — all client-side routes go to index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Static assets cache
|
|
location /assets/ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|