-
-
Save Paxa/be54db5f7063a804e5e6 to your computer and use it in GitHub Desktop.
Nginx compression and chache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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