Introduces the Go photo-api service, nginx/systemd deploy wiring, and Next.js gallery/lightbox pages so event photos can be managed and browsed. Co-authored-by: Cursor <cursoragent@cursor.com>
148 lines
4.5 KiB
Plaintext
148 lines
4.5 KiB
Plaintext
# ============================================================
|
|
# Spanglish Community - Frontend
|
|
# spanglishcommunity.com / www
|
|
# ============================================================
|
|
|
|
server {
|
|
listen 80;
|
|
server_name spanglishcommunity.com www.spanglishcommunity.com;
|
|
|
|
# ACME
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/html;
|
|
}
|
|
|
|
# Force HTTPS
|
|
location / {
|
|
return 301 https://spanglishcommunity.com$request_uri;
|
|
}
|
|
}
|
|
|
|
# Canonical host is the apex (non-www). Redirect the www HTTPS vhost to it with a
|
|
# 301 so only one host is served and indexed.
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
|
|
server_name www.spanglishcommunity.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/spanglishcommunity.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/spanglishcommunity.com/privkey.pem;
|
|
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
return 301 https://spanglishcommunity.com$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
|
|
server_name spanglishcommunity.com;
|
|
|
|
# Upload size limit (covers same-origin /api uploads via this vhost)
|
|
client_max_body_size 20m;
|
|
|
|
# SSL
|
|
ssl_certificate /etc/letsencrypt/live/spanglishcommunity.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/spanglishcommunity.com/privkey.pem;
|
|
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
# Security
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# Logs
|
|
access_log /var/log/nginx/spanglish_frontend_access.log;
|
|
error_log /var/log/nginx/spanglish_frontend_error.log;
|
|
|
|
# LNbits payment SSE stream - must not be buffered or events won't flush in
|
|
# real time. Regex location takes precedence over the /api prefix below.
|
|
location ~ ^/api/lnbits/stream/ {
|
|
proxy_pass http://spanglish_backend;
|
|
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_set_header Connection '';
|
|
|
|
# Disable buffering/caching for Server-Sent Events
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 3600s;
|
|
proxy_connect_timeout 300s;
|
|
}
|
|
|
|
# Photo gallery service (photo-api, port 3020). ^~ wins over the /api
|
|
# prefix below. Batch photo uploads are large and slow, so the body cap
|
|
# is raised and request buffering is off for this location only.
|
|
location ^~ /api/photos/ {
|
|
proxy_pass http://spanglish_photos;
|
|
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;
|
|
|
|
client_max_body_size 100m;
|
|
proxy_request_buffering off;
|
|
proxy_read_timeout 300s;
|
|
proxy_connect_timeout 300s;
|
|
}
|
|
|
|
# Proxy /api to backend
|
|
location /api {
|
|
proxy_pass http://spanglish_backend;
|
|
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 300s;
|
|
proxy_connect_timeout 300s;
|
|
}
|
|
|
|
# Proxy /uploads to backend
|
|
location /uploads {
|
|
proxy_pass http://spanglish_backend;
|
|
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;
|
|
|
|
# Cache static files
|
|
proxy_cache_valid 200 1d;
|
|
expires 1d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Frontend App
|
|
location / {
|
|
proxy_pass http://spanglish_frontend;
|
|
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;
|
|
|
|
# WebSocket / HMR
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_read_timeout 60s;
|
|
proxy_connect_timeout 60s;
|
|
}
|
|
}
|