DirectAdmin is a commercial host management panel commonly used in foreign hosts. It is simple to use and has comprehensive functions. It uses the Apache processing engine by default, but the default engine does not have Mod_cache. Mod_cache can cache common static files, such as css, js, etc., to improve web page loading speed. Since we can speed up access, what are we waiting for? Must go! Below, record and share the process of adding Mod_cache to [#$dp3]DirectAdmin.
Adding Mod_cache to DirectAdmin is divided into 2 steps: compilation and configuration. First, let's look at the compilation process. We record this process with code and explanations.
cd /usr/local/directadmin/custombuild/configure/ap2
#Enter the Apache2 directory (apache2.2 installed by my DA, the latest version is 2.4)
vi configure.apache
#Modify the compilation configuration file
We need to add the Mod_cache compilation part to the compilation configuration file.
"--enable-cache"
"--enable-disk-cache"
"--enable-mem-cache"
Add at the end of the file code, as shown in the picture (the red box is the part I added):

Note that line 34 of the code, which is the last line of the default file, is added at the end. This must Do it, otherwise an error may be reported:
/usr/local/directadmin/custombuild/configure/ap2/configure.apache: line 36: --enable-cache: command not found
OK, modify Once that's done, we start compiling.
cd /usr/local/directadmin/custombuild #Enter directory
./build apache #Compile
This compilation process is usually completed in 3-5 minutes. Don't walk away, it will be over soon...
After the compilation is completed, let's configure the mod_cache parameters.
cd /etc/httpd/conf/extra/ #Enter directory
vi httpd-includes.conf #Edit configuration file
Add the following content to the configuration file (no need to add subsequent comments):
<IfModule mod_cache.c>
#CacheForceCompletion 100 #Number of cached files (no limit by default)
CacheDefaultExpire 3600 #Cache default expiration time (seconds)
CacheMaxExpire 86400 #Cache maximum expiration time (seconds)
CacheLastModifiedFactor 0.1 #Cache time calculation formula, please check the network information for details<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 512000 #Memory buffer size, adjusted according to server memory size (unit: kb)
MCacheMaxObjectCount 10000 #Number of buffer files
MCacheMinObjectSize 1 #Buffer Area minimum file (unit: kb)
MCacheMaxObjectSize 51200 #Buffer area maximum file (unit: kb)
</IfModule>
</IfModule>
Once done, save and exit edit mode.
Next, restart Apache and you're done.
service httpd restart
