Skip to content

Instantly share code, notes, and snippets.

@shapeshed
Created March 8, 2013 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shapeshed/5115387 to your computer and use it in GitHub Desktop.
Save shapeshed/5115387 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name www.shapeshed.com;
rewrite ^/(.*) http://shapeshed.com/$1 permanent;
}
server {
if ($host != 'shapeshed.com' ) {
rewrite ^/(.*) http://shapeshed.com/$1 permanent;
}
server_name shapeshed.com;
listen 80 default;
charset utf-8;
access_log off;
root /srv/shapeshed.com/;
gzip_static on;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
if ($request_method !~ ^(GET|HEAD)$ ){
return 405;
}
rewrite ^/journal/?$ / permanent;
rewrite ^/blog/archives/?$ / permanent;
rewrite ^/about/?$ / permanent;
rewrite ^/talks/?$ / permanent;
rewrite ^/contact/?$ / permanent;
rewrite ^/portfolio/?$ / permanent;
rewrite ^/tags/?$ / permanent;
rewrite ^/archives/?$ / permanent;
rewrite ^/s/(.*)/?$ / permanent;
rewrite ^/page/(.*)/?$ / permanent;
rewrite ^/journal/techno_kittens_love_HTML5/?$ /journal/techno_kittens_love_html5/ permanent;
rewrite ^/search/results/(.*)/?$ / permanent;
rewrite ^/journal/tag/(.*)/?$ / permanent;
rewrite ^/journal/(.*)/?$ /$1 permanent;
rewrite ^/portfolio/(.*)/?$ / permanent;
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
location = /favicon.ico {
expires max;
add_header Cache-Control public;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm)$ {
expires 1M;
add_header Cache-Control "public";
}
location ~* \.(?:css|js)$ {
log_not_found off;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
location ~ \.php$ {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment