Skip to content

Instantly share code, notes, and snippets.

@mockra mockra/nginx
Last active May 29, 2019

Embed
What would you like to do?
nginx config for static site
server {
listen 80;
root /var/www/yourdomain.com/public;
index index.html index.htm;
server_name yourdomain.com;
location / {
default_type "text/html";
try_files $uri.html $uri $uri/ /index.html;
}
}
@gogotanaka

This comment has been minimized.

Copy link

commented Aug 17, 2014

I really appreciate your documents!(http://mockra.com/2014/02/17/nginx-static-sites/

Thank you!

@andriyfm

This comment has been minimized.

Copy link

commented Mar 7, 2018

Nice

@dumptyd

This comment has been minimized.

Copy link

commented Jul 7, 2018

try_files $uri.html $uri $uri/ /index.html; should be changed to try_files $uri.html $uri $uri/ =404; imo, otherwise it will render index.html for any route you visit on the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.