Files
nginx-configs/CLAUDE.md
T
hikari 1cfae51620
Test nginx configuration / Static Analysis (push) Failing after 4s
Test nginx configuration / nginx Syntax Check (push) Successful in 17s
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m4s
docs: add CLAUDE.md with 404 handling and site setup notes
2026-03-10 12:59:07 -07:00

1.3 KiB

NGINX Configs — Project Notes

404 Handling

Global 404 redirect

Any 404 from any site is handled globally via nginx/nginx/nginx.conf in the http {} block:

error_page 404 https://404.nhcarrigan.com;

This redirects (302) to 404.nhcarrigan.com which serves /home/naomi/404/index.html. No need to add error_page to individual server blocks — the http {} level default covers everything.

404 site config

nginx/nginx/sites-available/404.conf — serves the static 404 page at /home/naomi/404. Requires an SSL cert at /etc/letsencrypt/live/404.nhcarrigan.com/.

Catch-all server block (catch-all.conf)

Handles any HTTPS request for a subdomain that doesn't match any configured server_name. Uses default_server on port 443, server_name _, and serves the same 404 page directly (with return 404 to preserve the status code, since this is the final fallback rather than a redirect).

Adding a New Site

  1. Create nginx/nginx/sites-available/<name>.conf with the server block.
  2. Create a symlink: ln -s ../sites-available/<name>.conf nginx/nginx/sites-enabled/<name>.conf
  3. Ensure an SSL cert exists on the server for the domain (certbot --nginx -d <domain>).
  4. No need to add error_page 404 — it's handled globally.