Skip to content

Instantly share code, notes, and snippets.

@Paxa

Paxa/nginx.conf Secret

Created October 21, 2012 07:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Paxa/be54db5f7063a804e5e6 to your computer and use it in GitHub Desktop.
Save Paxa/be54db5f7063a804e5e6 to your computer and use it in GitHub Desktop.
Nginx compression and chache
gzip on;
gzip_http_version 1.0;
gzip_comp_level 9;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/css application/x-javascript text/html text/xml application/xml application/xml+rss text/javascript;
# Some version of IE 6 don't handle compression well on some mime-types, so just disable for them
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Set a vary header so downstream proxies don't send cached gzipped content to IE6
gzip_vary on;
if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){
return 405;
}
location ~ ^/(assets|images|stylesheets|swfs|system)/ {
expires max;
add_header Cache-Control public;
}
location = /favicon.ico {
expires max;
add_header Cache-Control public;
}
location ~ \.php$ {
deny all;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment