2026-04-07 21:58:21 -04:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name _;
|
|
|
|
|
|
2026-05-16 08:44:50 -04:00
|
|
|
# Docker embedded DNS — defers upstream resolution to request time
|
|
|
|
|
# This prevents nginx crashing at startup if sibling containers aren't
|
|
|
|
|
# ready yet (which happens on the first `docker compose up`).
|
|
|
|
|
resolver 127.0.0.11 valid=10s ipv6=off;
|
|
|
|
|
|
2026-04-07 22:05:41 -04:00
|
|
|
# Allow unlimited client upload size
|
|
|
|
|
client_max_body_size 0;
|
|
|
|
|
|
2026-04-07 21:58:21 -04:00
|
|
|
# Gzip compression
|
|
|
|
|
gzip on;
|
|
|
|
|
gzip_types text/plain text/css text/javascript application/javascript application/json;
|
|
|
|
|
gzip_min_length 1000;
|
|
|
|
|
|
|
|
|
|
# Root location - serve static files
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
|
2026-05-23 15:40:26 -04:00
|
|
|
# Fonts, icons, images: rarely change, safe to cache aggressively.
|
|
|
|
|
location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
2026-04-07 21:58:21 -04:00
|
|
|
expires 1y;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-23 15:40:26 -04:00
|
|
|
# CSS / JS — must revalidate so a redeploy is picked up immediately.
|
|
|
|
|
# The index.html links these without a version query string, so without
|
|
|
|
|
# this rule a stale stylesheet/script sits in the browser cache forever
|
|
|
|
|
# (which produced the unstyled calendar that triggered this fix).
|
|
|
|
|
location ~* \.(css|js)$ {
|
2026-05-17 08:30:49 -04:00
|
|
|
expires -1;
|
|
|
|
|
add_header Cache-Control "no-cache, must-revalidate";
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 21:58:21 -04:00
|
|
|
# HTML files - no cache
|
|
|
|
|
location ~* \.html?$ {
|
|
|
|
|
expires -1;
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-18 07:29:50 -04:00
|
|
|
# Live HLS — served from /live (bind-mounted shared volume), low cache so playlist refreshes
|
|
|
|
|
location /live/ {
|
|
|
|
|
alias /live/;
|
|
|
|
|
types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; }
|
|
|
|
|
add_header Cache-Control "no-cache";
|
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 21:58:21 -04:00
|
|
|
# API proxy - forward to mam-api service
|
|
|
|
|
location /api/ {
|
2026-05-16 08:44:50 -04:00
|
|
|
set $api_upstream http://mam-api:3000;
|
2026-04-07 22:05:41 -04:00
|
|
|
client_max_body_size 0;
|
2026-05-16 08:44:50 -04:00
|
|
|
proxy_pass $api_upstream;
|
2026-04-07 21:58:21 -04:00
|
|
|
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_buffering off;
|
|
|
|
|
proxy_request_buffering off;
|
2026-04-07 22:05:41 -04:00
|
|
|
proxy_connect_timeout 300;
|
|
|
|
|
proxy_send_timeout 300;
|
|
|
|
|
proxy_read_timeout 300;
|
2026-04-07 21:58:21 -04:00
|
|
|
}
|
|
|
|
|
|
2026-05-17 21:44:15 -04:00
|
|
|
# Editor proxy - forward to the openreel-video fork
|
|
|
|
|
location /editor/ {
|
|
|
|
|
set $editor_upstream http://editor:80/;
|
|
|
|
|
proxy_pass $editor_upstream;
|
|
|
|
|
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;
|
|
|
|
|
client_max_body_size 8g;
|
|
|
|
|
proxy_request_buffering off;
|
|
|
|
|
proxy_buffering off;
|
|
|
|
|
proxy_read_timeout 600s;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-07 21:58:21 -04:00
|
|
|
# Capture proxy - forward to capture service
|
|
|
|
|
location /capture/ {
|
2026-05-16 08:44:50 -04:00
|
|
|
set $capture_upstream http://capture:3001;
|
|
|
|
|
proxy_pass $capture_upstream;
|
2026-04-07 21:58:21 -04:00
|
|
|
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_buffering off;
|
|
|
|
|
proxy_request_buffering off;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# SPA fallback - try to serve file, else route to index.html
|
|
|
|
|
location / {
|
2026-05-18 10:03:32 -04:00
|
|
|
try_files $uri $uri/ /home.html;
|
2026-04-07 21:58:21 -04:00
|
|
|
expires -1;
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Health check endpoint
|
|
|
|
|
location /health {
|
|
|
|
|
access_log off;
|
|
|
|
|
return 200 "healthy\n";
|
|
|
|
|
add_header Content-Type text/plain;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Deny access to dotfiles
|
|
|
|
|
location ~ /\. {
|
|
|
|
|
deny all;
|
|
|
|
|
}
|
|
|
|
|
}
|