LC Notes

Nginx basics: server blocks and redirects

One server block per site keeps things clear. Set the server name, the document root and the index file, and use try_files so missing pages return a proper 404 instead of a directory listing.

Keep HTTP on port 80 for the certificate check, and redirect everything else to HTTPS once the certificate is in place. Run nginx -t before every reload.

Do not put proxy settings and website settings in the same block unless you mean to. A small site is easier to debug when the static files and the proxy location are separate.