[CentOS] enable caching in apache

Tim Dunphy

bluethundr at gmail.com
Mon Jul 7 20:50:55 UTC 2014


hey all,

 I am serving up a couple of sites using apache with varnish sitting in
front of it.

 When I check the headers for the site, this is what I'm seeing:

[root at ops:~] #curl -I http://ref.mydomain.com/
HTTP/1.1 200 OK
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.6.0-dev
Set-Cookie: PHPSESSID=rqetkvi6l54819fffdivkppo90; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: *no-store, no-cache,* must-revalidate, post-check=0,
pre-check=0
Content-Type: text/html; charset=UTF-8
Content-Length: 55548
Accept-Ranges: bytes
Date: Mon, 07 Jul 2014 20:46:32 GMT
X-Varnish: 594446632
Age: 0
Via: 1.1 varnish
Connection: close


I've tried setting these cache related directives but so far had no luck in
getting the site to be cache enabled:

#48 Hours
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>

# 2 HOURS
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

Header unset Pragma

How can I set the cache directive settings in apache that would allow this
site to be cached?

Thanks
Tim
-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B



More information about the CentOS mailing list