pagepiper/docker/web/nginx.cloud.conf
pyr0ball c24bd33478 feat(deploy): add cloud deploy config for pagepiper.circuitforge.tech
- compose.cloud.yml: pagepiper-cloud project on port 8533 (avoids
  conflict with Linnet dev on 8521/Magpie on 8531)
- docker/web/nginx.cloud.conf: handles both /pagepiper/* path (primary
  domain, no Caddy strip) and / path (menagerie, Caddy strips prefix)
- docker/web/Dockerfile: NGINX_CONF build arg to select dev vs cloud conf
- .env.cloud.example: cloud env template with BYOK gate vars
- manage.sh: cloud:start|stop|restart|status|logs|build commands

Caddy config updated separately (not in this repo).
DNS record needed: pagepiper.circuitforge.tech → Heimdall edge IP.
2026-05-05 07:12:48 -07:00

59 lines
2.1 KiB
Text

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# API requests when accessed via Caddy (prefix already stripped by handle_path)
location /api/ {
proxy_pass http://api:8522;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $http_x_real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-CF-Session $http_x_cf_session;
client_max_body_size 50m;
# PDF uploads and LLM inference can be slow
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
# API requests when accessed directly via pagepiper.circuitforge.tech
# VITE_API_BASE=/pagepiper means frontend builds calls as /pagepiper/api/...
# Caddy passes these unchanged; nginx strips /pagepiper prefix here.
location /pagepiper/api/ {
rewrite ^/pagepiper(/api/.*)$ $1 break;
proxy_pass http://api:8522;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $http_x_real_ip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-CF-Session $http_x_cf_session;
client_max_body_size 50m;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
# Static assets at the /pagepiper/ base — used when Caddy does NOT strip the prefix
# (i.e., pagepiper.circuitforge.tech routes, where /pagepiper is the Vite base URL).
# ^~ prevents regex asset location from matching first.
location ^~ /pagepiper/ {
alias /usr/share/nginx/html/;
try_files $uri $uri/ /index.html;
}
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
try_files $uri /index.html;
}
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}