Install mod_cloudflare.so, file_cache_module.so and mod_mem_cache.so on CentOS 6

How to Install mod_cloudflare.so, file_cache_module.so and mod_mem_cache.so on CentOS 6

Check for installed modules:

# httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 substitute_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_ajp_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 perl_module (shared)
 php5_module (shared)
 ssl_module (shared)
 wsgi_module (shared)
Syntax OK

file_cache is not installed

Install the required development packages:

# yum install httpd-devel gcc

Get your current running Apache version :

# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jan 12 2017 17:09:39

or

# rpm -qv httpd
httpd-2.2.15-56.el6.centos.3.x86_64

Get the Apache source matching your running version from the archive download repository :

http://archive.apache.org/dist/httpd/

(this example would require the following package : http://archive.apache.org/dist/httpd/httpd-2.2.15.tar.gz)

# cd /usr/local/src
# wget http://archive.apache.org/dist/httpd/httpd-2.2.15.tar.gz

Untar:

# tar xvf httpd-2.2.15.tar.gz

Go to the module directory :

# cd httpd-2.2.15/modules/cache

Build the module:

# apxs -i -a -c mod_file_cache.c

The module has been compiled and added in httpd.conf.

Add mod_mem_cache:

apxs -c -i mod_mem_cache.c cache_cache.c cache_pqueue.c cache_hash.c

Check your configuration:


# service httpd configtest

If no error output, then reload the configuration :

service httpd reload

Check the installed modules:

# httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 substitute_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_ajp_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 file_cache_module (shared)
 perl_module (shared)
 php5_module (shared)
 ssl_module (shared)
 wsgi_module (shared)
Syntax OK

file_cache is installed but mem_cache is not seen. Check the apache configuration file – its disabled by default – enable it:

#nano /etc/httpd/conf/httpd.conf
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

#
# The following modules are not loaded by default:
#
#LoadModule asis_module modules/mod_asis.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule cgid_module modules/mod_cgid.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule filter_module modules/mod_filter.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule file_cache_module  /usr/lib64/httpd/modules/mod_file_cache.so
LoadModule mem_cache_module   /usr/lib64/httpd/modules/mod_mem_cache.so

# service httpd restart
httpd -M
 mem_cache_module (shared)

Cloudflare module installation:

# https://www.cloudflare.com/technical-resources/

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.