Skip to content

Instantly share code, notes, and snippets.

@mm53bar
Last active February 11, 2019 15:48
Show Gist options
  • Save mm53bar/4698426 to your computer and use it in GitHub Desktop.
Save mm53bar/4698426 to your computer and use it in GitHub Desktop.
A simple nginx virtual server config. Should redirect all requests to / except for those that actually have a match (i.e. html/images/css/js).
server {
listen 80;
server_name amaroadreports.ca www.amaroadreports.ca;
root /srv/road_reports_static;
location / {
try_files $uri/index.html $uri.html $uri @missing;
}
location @missing {
rewrite ^ $scheme://$host/ redirect;
}
}
@jbabe
Copy link

jbabe commented Feb 4, 2013

I've added this to a script to download Sarah's page and setup nginx - I didn't get a chance to test this locally yet:

https://gist.github.com/4705042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment