Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created August 1, 2012 10:37
Show Gist options
  • Save gerhard/3225704 to your computer and use it in GitHub Desktop.
Save gerhard/3225704 to your computer and use it in GitHub Desktop.
Preventing nginx from adding the trailing slash onto subdirs
server {
...
# asset files (.css, .js, .png etc.) are not served correctly...
location /developer {
rewrite /(.*)/? /$1/index.html break;
root /mnt/www/docs/public;
}
# ... so they get a separate entry
# Being a more specific match, nginx uses this one for assets.
location /developer/assets {
root /mnt/www/docs/public;
}
...
}
@gerhard
Copy link
Author

gerhard commented Aug 1, 2012

Want to avoid if conditions...

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