apache configuration for speed up with Yslow

well, this is an example of my test server。
 

        DocumentRoot "/home/local_workspace/admin/web"
        ServerName admin.localhost.pc
        ServerAdmin amdin.localhost.pc
        CustomLog "/home/local_workspace/admin/app/logs/admin.access.log" common
        ErrorLog "/home/local_workspace/admin/app/logs/admin.error.log"
        
                order allow,deny
                allow from all
                Options All
                AllowOverride All
                Header unset Etag
                FileETag none
        
        
                ExpiresActive On
                ExpiresByType image/gif "access plus 1 months"
                ExpiresByType image/jpg "access plus 1 months"
                ExpiresByType image/jpeg "access plus 1 months"
                ExpiresByType image/png "access plus 1 months"
                ExpiresByType image/vnd.microsoft.icon "access plus 1 months"
                ExpiresByType image/x-icon "access plus 1 months"
                ExpiresByType image/ico "access plus 1 months"
                ExpiresByType application/javascript "now plus 1 months"
                ExpiresByType application/x-javascript "now plus 1 months"
                ExpiresByType text/javascript "now plus 1 months"
                ExpiresByType text/css "now plus 1 months"
                ExpiresDefault "access plus 1 days"
        
  
        
        CacheEnable mem /
        MCacheSize 262144
        MCacheMaxObjectCount 10000
        MCacheMinObjectSize 1
        MCacheMaxObjectSize 1000000
        MCacheRemovalAlgorithm LRU
        
  

    php_value session.cookie_domain localhost.pc



mod_expires for adding an expire header.
mode_cach to have an memecache.
cookie_domain: to add a cookie domain for these file which is not image/js/css, and so image/js/css is cookie _free,

see this article:

 "!\.(gif|jpe?g|png)$">
    php_value session.cookie_domain example.com
What it means is that if you do not set images in cookie information. Then images are cookie-free with server.
and also there is an explaination about cookie free:

Is it possible to use .htaccess to redirect all requests for a particular folder on www.example.com to a folder on static.example.com instead?
Possible, but counter productive — the client would have to make an HTTP request, get the redirect response, then make another HTTP request.
This costs a lot more than the single line of cookie data saved!
Would this method also fool the CMS into thinking the images were located in the default locations on its own domain?
original post is here:
http://stackoverflow.com/questions/1433131/htaccess-yslow-and-use-cookie-free-domains

评论

热门帖子