MSNCodeSNIPPETS← msncode.dev
snippets/nginx

Serve Static Files

Serve static files from a directory

nginxnginxstaticserve
NGINX
location / {
  root /var/www/html;
  try_files $uri $uri/ =404;
}

More nginx snippets

Custom 404 Page

Serve a custom error page for 404s

Enable Gzip Compression

Compress responses to reduce bandwidth

Reverse Proxy to Backend

Forward requests to a backend server

Redirect HTTP to HTTPS

Force all traffic to use HTTPS