server { listen 80; server_name _; # Angular frontend (static build) root /var/www/armarium/frontend; index index.html; # API and media: proxy to Django/Gunicorn location /api/ { proxy_pass http://127.0.0.1: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; } location /media/ { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # Angular SPA: all other requests serve index.html location / { try_files $uri $uri/ /index.html; } }