|How to configure caching in httpd.conf file in Apache server 2.2|
caching configuration in Apache server 2.2
| 10:10 am on Dec 4, 2013 (gmt 0)|
I am new to Apache server configurations
I am trying to get the static files(images, css, js) files through Apache,
we want to maintain the images and css files in the cache for a while,
in order to do that i have place the following configuration in httpd.conf file
i have google and place this code in httpd.conf file
and i dont have .htaccess filein my apache server.
LoadModule expires_module modules/mod_expires.so
ExpiresDefault "access plus 1 week"
Header set Cache-Control "max-age=172800, public"
is it the one i need to place or can some one give some suggestions how to maintain cache and
how to test the caching is working on browsers.
[edited by: phranque at 8:45 pm (utc) on Dec 4, 2013]
[edit reason] no specifics please [/edit]
| 8:54 pm on Dec 4, 2013 (gmt 0)|
welcome to WebmasterWorld, kiran009!
do your HTTP Responses for the cacheable resources include the Expires and Cache-Control headers with expected values?
the Google Page Speed and Yahoo Yslow browser plugins will give you some information about cache headers for the resources on a given page.
| 4:28 am on Dec 6, 2013 (gmt 0)|
Thanks for replay Phranque,
i did not get fully, but have read somewhere about the mod_mem cache and mod_disck cache, is it any useful to configure in apache httpd conf file, and i still did not get how to test my configuration changes of httpd.conf file, whether i have place the proper configurations or not.
| 5:50 am on Dec 6, 2013 (gmt 0)|
all of your configuration directives are about browser caching and proxy server caching.
you have to look at the response headers after sending appropriate request headers (such as If-Modified-Since).
one easy method of examining the headers is to use the Google Page Speed and/or Yahoo Yslow browser plugins.
mod_mem_cache and mod_disk_cache are storage managers used by apache's mod_cache module to handle local or proxy caching by the web server.
your Expires and Cache-Control response headers may be used by mod_cache if you have it configured but those are end-to-end headers, so you don't necessarily need mod_cache to get some benefit.
| 2:03 pm on Dec 6, 2013 (gmt 0)|
We have cross checked on our http headers , i do not find any
'if modified since'. we are wondering how to configure it on Apache to enable this respose headers.
please give me some suggestions how to do this.
Thanks in advance
| 8:02 pm on Dec 6, 2013 (gmt 0)|
The "if-modified-since", "if-match", "if-none-match", etc. headers are sent along with a request for a page by the browser [user-agent] -- They're not headers sent by your server.
What Phranque was meaning is your server needs to be configured to properly send Expires and/or Cache-Control when a page is originally requested by a user-agent. Then when the user-agent re-requests the same page and sends an "if-modified-since" header your server must respond properly with a 304 Not Modified header, if: The expires date is not passed and/or the cache-control time has not passed.
Keep in mind: if a cache-control header contains a max-age, then the cache-control max-age will override the date sent in the expires header, meaning if both are set and they're not the same, then compliant user-agents will use the cache-control max-age rather than the expires date.
| 8:32 pm on Dec 6, 2013 (gmt 0)|
Kiran, have you tried using Google Page Speed and/or Yahoo Yslow?
| 5:01 am on Dec 9, 2013 (gmt 0)|
I have tried the google page speed plugin , and it has shown some suggestions to improve the areas to optimize the performance, here is the report given by the plugin:
Click on the rule names to see suggestions for improvement.
Reduce blocking resources
Minimize delay in page load
(L)Specify image dimensions
so we are wondering how we can enable cache on browser through apache2.