General
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
How to switch a webserver to apache
Use CustomBuild to switch to Apache and to define the needed PHP engine. The following example uses PHP-FPM as the PHP engine to build Apache and PHP:
cd /usr/local/directadmin/custombuild
./build set webserver apache
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set php3_mode php-fpm
./build set php4_mode php-fpm
./build apache
./build php
./build rewrite_confs
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]"
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'
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
and you should see
mod_rewrite.c
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
Expected output:
[root@host]# httpd -M | grep deflate
deflate_module (static)
[root@host]#
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
Expected output:
[root@host]# httpd -M | grep remoteip
remoteip_module (static)
[root@host]#
Rules for Cloudflare's IPs can be found in the file /etc/httpd/conf/extra/httpd-cloudflare.conf
.
How to Check Apache Server Status
Apache server status can be accessed in your browser via http://Your-IP/server-status
.
There it will ask you to authenticate using the credentials that were randomly generated in /etc/httpd/conf/extra/httpd-info.conf
:
#Authenticate using:
#Username: randomly generated username
#Password: randomly generated password
If you don't see this, run
cd /usr/local/directadmin/custombuild
./build rewrite_confs
to generate new credentials.