mirror of
https://github.com/narrrl/holy-flavor-rater.git
synced 2026-11-03 16:41:27 +01:00
60 lines
2.8 KiB
Nginx Configuration File
60 lines
2.8 KiB
Nginx Configuration File
# =========================================================================
|
|
# Frontend nginx: serves the SPA, proxies /api to the Rust backend
|
|
# (holy-rust:8001), and serves /media straight from the shared bind mount.
|
|
# The per-group /api locations are kept explicit (one proxy_pass each) for
|
|
# readability; all point at rust_backend. The catch-all /api/ covers anything
|
|
# not listed.
|
|
# =========================================================================
|
|
|
|
upstream rust_backend {
|
|
server holy-rust:8001;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
|
|
# --- SPA -------------------------------------------------------------
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# --- API -> Rust backend ---------------------------------------------
|
|
# Longest-prefix match wins; these explicit groups and the catch-all
|
|
# /api/ all resolve to rust_backend.
|
|
location /api/categories/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location /api/flavors/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location /api/banners/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
|
|
location /api/auth/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location = /api/token/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; } # legacy JWT alias
|
|
location /api/ratings/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location /api/replies/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location /api/users/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location /api/notifications/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
location /api/tickets/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
|
|
location /api/admin-custom/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
|
|
# OpenAPI schema / Swagger UI:
|
|
location /api/schema { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
|
|
|
# Catch-all for any /api path not listed above.
|
|
location /api/ {
|
|
proxy_pass http://rust_backend;
|
|
include /etc/nginx/proxy_params.conf;
|
|
}
|
|
|
|
# --- Media -----------------------------------------------------------
|
|
# Served straight from the shared bind mount (read-only) so media does not
|
|
# depend on either backend being up — a prerequisite for retiring Django.
|
|
location /media/ {
|
|
alias /usr/share/nginx/media/;
|
|
access_log off;
|
|
expires 7d;
|
|
add_header Cache-Control "public";
|
|
try_files $uri =404;
|
|
}
|
|
}
|