Overview

Apache is the most widely used web server software. Developed and maintained by Apache Software Foundation, Apache is an open source software available for free. It is a webhosting industry standard and compatible with all website engines and CMSs. With event and worker MPMs, it benchmarks as well as Nginx in terms of concurrency (http://people.apache.org/~jim/presos/ACNA11/Apache_httpd_cloud.pdf).

You may get the basic information about your Apache installation with:

httpd -V
1

How to switch a webserver to apache

Use CustomBuild to switch to Apache and to define the needed PHP engine. The following example uses FastCGI as the PHP engine to build Apache and PHP:

cd /usr/local/directadmin/custombuild
./build update
./build set webserver apache
./build php1_mode fastcgi
./build php2_mode fastcgi
./build php3_mode fastcgi
./build php4_mode fastcgi
./build apache
./build php n
./build rewrite_confs
1
2
3
4
5
6
7
8
9
10

Valid choices for each of the options above in addition to the available PHP versions to be chosen from can be found like so:

cd /usr/local/directadmin/custombuild/
./build opt_help | grep "webserver\|mpm\|php._[mode|release]"
1
2

Which Apache MPM am I using?

Instead of implementing a single architecture, Apache provides a variety of MultiProcessing Modules (MPMs), which allow it to run in either a process-based mode, a hybrid (process and thread) mode, or an event-hybrid mode, in order to better match the demands of each particular infrastructure. Choice of MPM and configuration is therefore important.

To check what MPM is in use, you can ask the httpd binary:

httpd -V | grep 'MPM'
1

If you want to customize the MPM options, do it in the appropriate section of the /etc/httpd/conf/extra/httpd-mpm.conf file to customize it in a proper way.

How to ensure mod_rewrite is enabled

We get this question quite a bit, but not too sure why. It's always enabled in Apache by default. To confirm, type:

httpd -l | grep mod_rewrite
1

and you should see

 mod_rewrite.c
1

in the output if it's enabled.

Gzip Compression via Mod_deflate

This is enabled by default. Global rules are defined in /etc/httpd/conf/extra/httpd-deflate.conf. Confirm this is enabled via the following command:

httpd -M | grep deflate
1

Expected output:

[root@host]# httpd -M | grep deflate
 deflate_module (static)
[root@host]# 

1
2
3
4

Mod_RemoteIP

Since Mod_Cloudflare has been deprecated and Apache includes Mod_RemoteIP in Apache core, it is enabled by default and configured to work with Cloudflare automatically.

You can confirm it is enabled using this command:

httpd -M | grep remoteip
1

Expected output:

[root@host]# httpd -M | grep remoteip
 remoteip_module (static)
[root@host]# 

1
2
3
4

Rules for Cloudflare's IPs can be found in the file /etc/httpd/conf/extra/httpd-cloudflare.conf.

Last Updated: 6/23/2021, 9:36:08 PM