Skip to content

Instantly share code, notes, and snippets.

@rkjha
Last active August 29, 2015 14:24
Show Gist options
  • Save rkjha/7313c2822898c7203051 to your computer and use it in GitHub Desktop.
Save rkjha/7313c2822898c7203051 to your computer and use it in GitHub Desktop.
A sample nginx config for static websites.
server {
listen 80;
server_name www.example.com;
rewrite ^(.*) http://example.com$1 permanent;
}
server {
listen 80;
server_name example.com;
root /home/example_user/example.com/public;
# Cache static content
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 90d;
add_header Vary Accept-Encoding;
access_log off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment