Skip to content

Instantly share code, notes, and snippets.

@pekkis
Created February 21, 2013 13:40
Show Gist options
  • Save pekkis/5004795 to your computer and use it in GitHub Desktop.
Save pekkis/5004795 to your computer and use it in GitHub Desktop.
Static-domain
server {
listen 80;
server_name static.losofacebook.tunk.io;
root /home/user/losofacebook/web;
charset utf-8;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# odp
location ~* ^.+\.(odt|odp)$ {
access_log off;
gzip off;
expires 30d;
}
# non-zipped images
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
gzip off;
expires 30d;
}
# gzipped images
location ~* ^.+\.(svg)$ {
access_log off;
gzip on;
expires 30d;
}
# Documents
location ~* ^.+\.(css|js|html|txt)$ {
access_log off;
expires 30d;
gzip on;
charset utf-8;
}
# Web fonts, gzipped
location ~* ^.+\.(eot|ttf|otf|woff)$ {
access_log off;
gzip on;
expires 30d;
add_header Access-Control-Allow-Origin *;
}
# archives
location ~* ^.+\.(pdf|gz|bz2|exe|rar|zip|7z)$ {
access_log off;
gzip off;
}
# videos
location ~* ^.+\.(mp4|avi)$ {
access_log off;
gzip off;
}
# bad regexes
location ~* (\.svn|\.git) {
access_log off;
deny all;
}
location ~* ^/api/ {
deny all;
}
location = /index.html {
deny all;
}
location / {
try_files $uri =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment