Skip to content

Instantly share code, notes, and snippets.

@otienog1
Forked from zackad/nextjs.conf
Created November 23, 2021 11:35
Show Gist options
  • Save otienog1/9dd223c9da2d162b503526ae780fefca to your computer and use it in GitHub Desktop.
Save otienog1/9dd223c9da2d162b503526ae780fefca to your computer and use it in GitHub Desktop.
NGINX server configuration for nextjs static generated site.
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ /.+ {
try_files $uri $uri.html $uri =404;
}
location / {
index index.html index.htm;
}
error_page 404 /_errors/404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment