Apache allows you to setup content caching in many different ways, thereby reducing server load and improving website speed. However, to setup content caching in Apache, it is necessary to ensure that the required modules have been enabled properly. mod_expires is one such module which needs to be enabled for content caching. If it is not enabled, then caching will not work properly. Let us look at how to check if mod_expires is enabled.
What is mod_expires?
In the above example, ExpiresActive turns on mod_expires. ExpiresByType sets the expiration period for the specified content type.
How to Check if mod_expires is enabled
You can easily check if mod_expires is enabled with the following command, depending on your OS. On running the following command, Apache will show you all the enabled modules. Please note, Apache doesn’t allow you to specifically look for a single module.
$ /usr/sbin/apache2 -l
Most GNU/Linux distros:
$ /usr/sbin/httpd -l
On Mac OSX:
$ httpd -l
On Win 7 (64-bit):
C:\Users\myuser>"\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe" -l
Try these commands from a terminal window (CMD in case of Windows).
That’s it! Each of the above commands will list all the enabled modules. If mod_expires is enabled in your Apache server, you should find it in the output list.