Hi All, this document deals with how to setup mod cache in apache2.
Web caching the way of improving the server performance, so all the cached requests will be served from the cache resource without directly accessing from the web server. The dynamic contents will be shared from the web server itself.
In this document, I will show you how to install and configure mod_cache in apache web server.

Requirements:

* Running apache web server.

Installation

Enable the mod cache modules

a2enmod cache
a2enmod cache_disk
a2enmod expires
a2enmod headers

Restart the apache service in order to modules get affected.

Add the following configuration in the virtual host config file.

 

###cache 
CacheQuickHandler off
CacheLock on
CacheLockPath /tmp/mod_cache
CacheLockMaxAge 5
CacheIgnoreHeaders Set-Cookie

<Location />
CacheEnable disk
CacheHeader on
CacheDefaultExpire 800
CacheMaxExpire 64000
CacheIgnoreNoLastMod On
ExpiresActive on
ExpiresDefault A300
</Location>

CacheLockPath is the location to store the cached contents
location block tells the root location of the web server to be cached

Restart the apache service in order to apply the cache configuration.

Now try to access your application, after that, you can see /tmp/mod_cache directory and cache files are created in the provided the location.

 

© 2019, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.