Created
October 13, 2011 12:57
-
-
Save hilios/1284170 to your computer and use it in GitHub Desktop.
Nginx YSlow performance boost w/ Gzip + Far future expires Header
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
server { | |
# output compression saves bandwidth | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_vary on; | |
gzip_comp_level 6; | |
gzip_proxied any; | |
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
# make sure gzip does not lose large gzipped js or css files | |
# see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl | |
gzip_buffers 16 8k; | |
# Disable gzip for certain browsers. | |
gzip_disable “MSIE [1-6].(?!.*SV1)”; | |
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ { | |
expires 30d; | |
access_log off; | |
} | |
# location ~* \.(ico|css|js|gif|jp?g|png) { | |
# if ($args ~ [0-9]+) { | |
# expires max; | |
# break; | |
# } | |
# } | |
} |
it shows 500 error when i used this code in my .Htaccess file..plz help
@vjamba .htaccess is typically for use with Apache. This gist is about Nginx. Are you attempting to convert from Apache to Nginx? If so, this link may help you: http://stackoverflow.com/questions/8711678/change-apache-htaccess-file-to-be-used-with-nginx
pls how i can add the script gistfile1.txt
in nginx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
set Expire header on assets: see http://developer.yahoo.com/performance/rules.html#expires
location ~ ^/(images|javascripts|stylesheets)/ {
expires 1h;
}