Page 1 of 1

How to enable cache on apache2

Posted: Thu May 12, 2011 5:39 pm
by Shaka
this script that I share with you is to enable the cache to our web server apache2.
http://httpd.apache.org/docs/2.2/mod/mod_cache.html

open our configuration file conf / httpd.conf
look for the lines with the name: mod_cache, mod_disk_cache and mod_mem_cache.
modules enabled by removing the #

Code: Select all

 LoadModule cache_module modules/mod_cache.soLoadModule disk_cache_module modules/mod_disk_cache.soLoadModule mem_cache_module modules/mod_mem_cache.so 
Note: You can choose the mode of cache, hard disk or RAM.
just enable the module you want: mod_disk_cache.so or mod_mem_cache.so

added in the last line of the httpd.conf configuration file to read our new configuration file cache.

Code: Select all

 # Disk Cache / Mem CacheInclude conf/extra/httpd-cache.conf 
create a directory or folder in the root installation path of our apache web server with the name "cache"

create a file in "conf/extra/" will call "httpd-cache.conf"
and add this script to work.

httpd-cache.conf

Code: Select all

 ## Cache Configuration#<IfModule mod_cache.c># If you want to use mod_disk_cache instead of mod_mem_cache,# uncomment the line above and comment out the LoadModule line below.<IfModule mod_disk_cache.c>CacheRoot cacheCacheEnable disk /CacheDirLevels 5CacheDirLength 3</IfModule>  <IfModule mod_mem_cache.c>CacheEnable mem /MCacheSize 4096MCacheMaxObjectCount 100MCacheMinObjectSize 1MCacheMaxObjectSize 2048</IfModule> # When acting as a proxy, don't cache the list of security updatesCacheDisable http://security.update.server/update-list/</IfModule>   
restart our web server apache.