Commonly Used Apache Modules

By on September 8th, 2016

What is Apache?

Apache is the world’s most widely used web server. The Apache HTTP Server is often known as Apache. It was originally based on the NCSA HTTPd Server.

Apache Modules

The Apache is famous for it’s flexibility. Apache is implemented with the concept of modules. The modules allow Apache to perform additional functions. In short, the modules extend the Apache server. An administrator can easily configure Apache by adding and removing the modules according to required needs. Apache comes with a set or pre-installed modules.

You can get the installed Apache modules in your Linux server as follows.

Apache Module


This is an example of a Linux server. However, the modules installed in each server can vary in various servers. Now, let’s see the commonly used Apache modules and the purpose it is used for.

We have seen earlier that a Linux server is easily configurable to our needs. Let us take a look at an overview on commonly used Apache modules. It will help you better understand  Apache and allow you to configure the server effectively by choosing the appropriate ones for your requirements.


Commonly used Apache modules

The below list shows commonly used Apache modules.

1) Mod_security

2) Mod_rewrite

3) Mod_deflate

4) Mod_cache

5) Mod_proxy

6) Mod_ssl



Mod_security is a common Apache module. As the name indicates, it deals with the security of your server. Mod_security can protect the server from various attacks. It uses the regular expressions and rule sets to block the attacks. It works as a firewall. It could work either embedded or as a reverse proxy. A reverse proxy is a proxy server that accesses the servers on behalf of a client. They retrieve the resources from the servers and return to the client as they from the proxy server and not from the original server. Mod_security is very efficient in blocking SQL injection attacks. When a SQL injection attack is completed, it will return a 406 error.

The SQL injection attack

The SQL injection is a type of attack where the hackers inject SQL commands into an SQL statement via a web page input. As the name indicates this attack focuses on your database.



The mod_rewrite is also very popular in the web hosting industry. As the name indicates, it is used to rewrite the URLs and so that the redirection can be achieved. The module has a rewrite engine which will rewrite a requested URL based on a PCRE regular expression parser.

The mod_rewrite uses unlimited rules. Each rule can have unlimited attached rule conditions which enables the rewriting based on server and environment variables, HTTP headers, etc.

An example of a rule for redirecting a url that starts with ‘http’ to ‘https’ is given below.

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This is how the mod_rewrite works.



The next Apache module we are going to see is the mod_deflate. This module is used to compress the output from the webserver before sending to the client. This is used to reduce the size of the output file, so that the client can download it faster.

The following directive will enable the compression for documents in the container where it is placed.

SetOutputFilter DEFLATE

If Apache is being used as a reverse proxy and you need to process the content which passes through the proxy, you can use the mod_deflate for decompressing purpose as well. However, it is rarely used and the common use of mod_deflate is to compress the web server output. The mod_deflate uses a combination of LZ77 algorithm and Huffman coding. This ensures no data is lost while compressing the files. If the output file size is less than 120 bytes (approximately), then the output file will be larger after being processed by the mod_deflate. This happens because this module does not have a lower bound for the file size. The mod_gzip is similar to mod_deflate.



The mod_cache is the Apache module that is used for content caching. Let us take a look at this module in detail.

The Web Caching

Web caching is a way to improve the performance of the server. Here, the commonly requested content will be stored in an easy to access locations so that the client can access the data faster and client does not need to retrieve the data every time when the request is demanded. We can create caching rules for making caching effective. However, highly dynamic content will be served to the client normally from the server.

There are many other methods also used by Apache for the purpose of web caching and one of them is using mod_file_cache module.



The next module we are going to see is mod_proxy. This is an optional Apache module. This module implements a proxy, gateway for Apache server. It supports many commonly used protocols and many load balancing algorithms. To enable this feature, a set of modules will need to be loaded onto the server. This include the following.

1) mod_proxy

2) mod_proxy_balancer (If the load balancing is required, one or more balancer module also needed with this)

3) One or more proxy scheme, or protocol, module:



Mod_ssl also is an optional module of the Apache. It is used in Apache version 1.3 and version 2. It enables encryption via the Secured Sockets Layer (SSL) and Transport Layer Security (TLS) with the help of Open Source SSL/TLS toolkit OpenSSL. Its original version was created for Apache version 3 in 1998. The intention of this module is to provide SSL v3 and TLS v1.x support for the Apache server. The SSL v2 is no longer supported.

These are the commonly used Apache modules.


If you need any further assistance please contact our support department.



Leave a Reply