Files
AI_CPA/nginx/default.conf
T
Atharv1705 683e29e0d1 fix: update domain to aiindiacpa.duckdns.org
- nginx/default.conf: server_name aiindiacpa.duckdns.org + VPS IP (no trailing slash)
- main.py: CORS default fallback updated to new domain
- review.py: DASHBOARD_LINK reads from FRONTEND_URL env var (no hardcoded domain)
- login_email.py: login/signup email links read from FRONTEND_URL env var
- ALLOWED_ORIGINS in .env: https://aiindiacpa.duckdns.org + http://147.93.168.145
  (IP on port 80 via nginx, not 8000 direct FastAPI)
2026-08-10 11:38:24 +05:30

82 lines
3.1 KiB
Plaintext

server {
listen 80;
server_name aiindiacpa.duckdns.org 147.93.168.145;
# Max upload size — matches backend 10MB limit with buffer
client_max_body_size 15m;
# ── Static CSS (served directly from dist, no FastAPI hop) ───────────────
location /css/ {
root /usr/share/nginx/html;
expires 7d;
add_header Cache-Control "public, no-transform";
try_files $uri =404;
}
# ── Vite JS/CSS bundle assets (hashed filenames — cache forever) ─────────
location /assets/ {
root /usr/share/nginx/html;
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# ── Static images served from dist ───────────────────────────────────────
location /images/ {
root /usr/share/nginx/html;
expires 7d;
add_header Cache-Control "public, no-transform";
try_files $uri =404;
}
# ── Favicon and root-level static files ──────────────────────────────────
location = /favicon.svg {
root /usr/share/nginx/html;
expires 7d;
}
location = /icons.svg {
root /usr/share/nginx/html;
expires 7d;
}
# ── User-uploaded files (documents stored on VPS disk) ───────────────────
# Proxied through FastAPI for auth token validation — never served directly
location /api/upload/file/ {
proxy_pass http://app:8000;
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;
# Allow larger responses for file downloads
proxy_buffering off;
proxy_read_timeout 120s;
}
# ── All API routes → FastAPI ──────────────────────────────────────────────
location /api/ {
proxy_pass http://app:8000;
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;
proxy_read_timeout 60s;
proxy_send_timeout 60s;
}
# ── Health check (bypass FastAPI for load balancer pings) ────────────────
location = /health {
proxy_pass http://app:8000;
proxy_set_header Host $host;
}
# ── SPA fallback — serve index.html for all other routes ─────────────────
# React Router handles the actual routing client-side
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}