You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "--[ UxBoD ]--" <ux...@splatnix.net> on 2011/02/03 21:10:04 UTC
[users@httpd] Help with cache tuning
Hello all,
I have been trying to tune my Apache vhost config and hoping for some help to critique, flame and slap me with a wet fish for being so silly. So this is my config so far:
<VirtualHost *:80>
ServerAdmin webmaster@somedomain.com
DocumentRoot "/www/somedomain.com"
<Directory /www/somedomain.com>
AllowOverride All
<FilesMatch "\.(jp?g|gif|png|js|css|ico)$">
Header unset Etag
FileETag None
Header set Cache-control "public, max-age=604800"
</FilesMatch>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 30 minutes"
ExpiresByType text/css "access plus 2 weeks"
ExpiresByType text/javascript "access plus 2 weeks"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
</Directory>
ServerName www.somedomain.com
ServerAlias somedomain.com
AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript application/javascript application/xml
# Deactivate compression for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
DeflateCompressionLevel 6
# Set header information for proxies
Header append Vary User-Agent
ErrorLog "logs/www.somedomain.com-error.log"
CustomLog "logs/www.somedomain.com-access.log" common
</VirtualHost>
When I check with Chrome or Firefox I get messages about:
"The following cacheable resources have a short freshness lifetime"
"Consider adding a "Cache-Control: public" header to the following resources"
Yet I though from the above config I had added those. I am using mod_deflate and mod_pagespeed which appear to be doing quite a good job but I feel my lack of Apache core workings is really letting performance down.
Any help from the experienced community would be very much appreciated by a n00b.
--
Thanks, Phil
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Help with cache tuning
Posted by Igor Galić <i....@brainsware.org>.
----- "--[ UxBoD ]--" <ux...@splatnix.net> wrote:
> Hello all,
>
> I have been trying to tune my Apache vhost config and hoping for some
> help to critique, flame and slap me with a wet fish for being so
> silly. So this is my config so far:
>
> <VirtualHost *:80>
> ServerAdmin webmaster@somedomain.com
> DocumentRoot "/www/somedomain.com"
> <Directory /www/somedomain.com>
> AllowOverride All
>
> <FilesMatch "\.(jp?g|gif|png|js|css|ico)$">
> Header unset Etag
(This seems paranoid)
> FileETag None
(When you already have this... To me it would make sense on a proxy only.)
> Header set Cache-control "public, max-age=604800"
Just one week?
> </FilesMatch>
>
> ExpiresActive On
>
> ExpiresDefault "access plus 1 month"
And here you have a default of one month that doesn't fit together..
> ExpiresByType text/html "access plus 30 minutes"
now.. this is probably silly... Your content isn't *that* dynamic ;)
> ExpiresByType text/css "access plus 2 weeks"
> ExpiresByType text/javascript "access plus 2 weeks"
And so is this and
> ExpiresByType image/png "access plus 1 month"
> ExpiresByType image/gif "access plus 1 month"
> ExpiresByType image/jpg "access plus 1 month"
and this, again... you made this a default, remember?
My suggestion is: Set the Expires for CSS, JS and Images to be something like 30 years.
When you actually have a new version, upload it under a new name.
For covering a good 80% of yslow, take a look at:
http://omniti.com/seeds/fast-by-default
for covering the other 20% see:
http://lethargy.org/~jesus/writes/web-performance-boot-camp
> </Directory>
>
> ServerName www.somedomain.com
> ServerAlias somedomain.com
>
> AddOutputFilterByType DEFLATE text/html text/css text/xml
> application/x-javascript application/javascript application/xml
>
> # Deactivate compression for buggy browsers
> BrowserMatch ^Mozilla/4 gzip-only-text/html
> BrowserMatch ^Mozilla/4\.0[678] no-gzip
> BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
>
> DeflateCompressionLevel 6
>
> # Set header information for proxies
> Header append Vary User-Agent
>
> ErrorLog "logs/www.somedomain.com-error.log"
> CustomLog "logs/www.somedomain.com-access.log" common
> </VirtualHost>
>
> When I check with Chrome or Firefox I get messages about:
>
> "The following cacheable resources have a short freshness lifetime"
> "Consider adding a "Cache-Control: public" header to the following
> resources"
>
> Yet I though from the above config I had added those. I am using
> mod_deflate and mod_pagespeed which appear to be doing quite a good
> job but I feel my lack of Apache core workings is really letting
> performance down.
>
> Any help from the experienced community would be very much appreciated
> by a n00b.
> --
> Thanks, Phil
i
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org