• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / apache server tutorial (install,config, performance tuning, security, error handling) / enable caching in apache server (mod cache disk cache) vs fastcgi cache

enable caching in apache server (mod cache disk cache) vs fastcgi cache

Table of Contents

Toggle
  •  what is caching & full page cache?
    • #1. Update package dependencies & install apache utils
    • #2 enable mod cache , cache disk expires headers modules
    • #3 edit the apache 2 config
    • #3.1 understanding cache variables
    • #4 check syntax errors & restart the apache server
      • Cache Behind Web Server
      • Cache in Front of Web Server
    • Nginx fastcgi cache  vs varnish

 what is caching & full page cache?

if apache server gets a request to sends to database through php.
the backend process also called as server response time or ttfb.
to avoid this
web server caches pages which frequently serving from database without any changes.
caching the page (dynamically generated) and stores it as static page for a time TTL setby server admin while configuring.
opcode cache, mysql object cache. page cache.
in wordpress it’s done w3tc, supercache by php.
but webserver lightweight and faster than php in most cases.
you can also try nginx as reverse proxy for apache caching

#1. Update package dependencies & install apache utils

apt-get update &&  apt-get install apache2-utils

#2 enable mod cache , cache disk expires headers modules

enable mods if not available then install.
sudo a2enmod cache
sudo a2enmod cache_disk
sudo a2enmod expires
sudo a2enmod headers
restart the apache server
sudo systemctl restart apache2

#3 edit the apache 2 config

sudo nano /etc/apache2/sites-available/example.com.conf
CacheQuickHandler offCacheLock onCacheLockPath /tmp/m
od_cache-lockCacheLockMaxAge 5CacheIgnoreHeaders
Set-Cookie<Location />
  CacheEnable disk    CacheHeader on
CacheDefaultExpire 800
CacheMaxExpire 64000
  CacheIgnoreNoLastMod On    ExpiresActive on
  ExpiresDefault A300</Location>

#3.1 understanding cache variables

 

location & size of the cache

if cache size is set to toohigh (checking the request in cache slower than without implementing cache)

Location of the hdd/SSD or ram

read& write speeds

hdd 100mbs

SSD 500mb

SSD nvme 3gb/s

ram 16gb/s

if cache size is lesser, say 300mb,

it’s better to use ram, if available,

cost of 1gb ram in cloud hosting $10* per month.1

gb SSD $1*permonth.(checkout gce ,AWS, do price calculator)

cache TTL or expiry: based on how frequently content changes, for WordPress blogposts

1hour not a issue,

dynamic sites it should be very lower, in minutes also called as microcaching in nginx

#4 check syntax errors & restart the apache server

sudo apachectl configtest && service apache2 reload
caching strategies

Cache Behind Web Server

front end cache serves without checking the server, php,MySQL, by linux sendfile () option.

 

Cache in Front of Web Server

If CacheQuickHandler is set to On,  then request go to apache then cache, faster than without cache, slower than frontend rache.

Nginx fastcgi cache  vs varnish

inorder to use fastcgi in apache you should install nginx as reverse proxy.
varnish is old & popular.but with new technologies like nginx fastcgi less used.
varnish cache: apache serves plain html pages
 without css&js in hight loads.

Primary Sidebar

apache server tutorial (install,config, performance tuning, security, error handling)

  • what is If-Modified-Since HTTP header how to add to Wordpress website
  • htaccess tutorial tips for wordpress #redirect #leverage browser cache #Gzip #KeepAlive
  • apache modules list (explained, enable disable)
  • connect to server by SSH client Putty SFTP client winscp LAMP, LEMP nginx apache etc linux
  • Lamp stack install on Ubuntu 20.4 LTS apache, mysql, php 7.4(Debian 9 & Ubuntu 18.04 lts)
  • apache performance tuning mpm-worker vs prefork vs event modules
  • enable caching in apache server (mod cache disk cache) vs fastcgi cache
  • how to enable KeepAlive connections in apache nginx wordpress
  • Cache control Header & expires headers How to set Properly
  • apache2 conf sample explained apache configuration file modules etc
  • restart apache in ubuntu (start | stop | reload | config test) centos debian mac linux windows 10 xampp
  • uninstall apache2 ubuntu in 3 steps Debian

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy