# ============================================================================= # nginx vhost — feedthepyre.com # ============================================================================= # Serves the PYRE app at /, the API at /api, and the dev status tracker at # /status. Installed to /etc/nginx/sites-available/feedthepyre.com by # scripts/deploy-web.sh; certbot --nginx mirrors this server to a 443 block and # adds the HTTP->HTTPS redirect. # # Upstreams (pm2): web = 127.0.0.1:3000 (Next.js), api = 127.0.0.1:4000 (Fastify) # ============================================================================= server { listen 80; listen [::]:80; server_name feedthepyre.com www.feedthepyre.com; access_log /var/log/nginx/feedthepyre.access.log; error_log /var/log/nginx/feedthepyre.error.log; gzip on; gzip_proxied any; gzip_types text/plain text/css application/json application/javascript application/xml image/svg+xml; client_max_body_size 1m; # Let's Encrypt HTTP-01 (kept so cert renewals work). location ^~ /.well-known/acme-challenge/ { root /var/www/feedthepyre/status; allow all; } # --- Dev status tracker (static) -> /status ----------------------------- location = /status { return 301 /status/; } location /status/ { alias /var/www/feedthepyre/status/; index index.html; try_files $uri $uri/ /status/index.html; } # --- API (Fastify) ------------------------------------------------------ # No trailing slash on proxy_pass: the /api/ prefix is preserved, so the # backend receives /api/scan (its actual route). location /api/ { proxy_pass http://127.0.0.1:4000; 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 60s; } # --- Web app (Next.js) -------------------------------------------------- location / { proxy_pass http://127.0.0.1:3000; 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; } }