Table of Contents

Middleware

Apache HTTP Server Configuration Examples



References


Installing


Commands

configtest

Environment Commands Note
Source /usr/local/apache2/bin/apachectrl configtest
/usr/local/apache2/bin/httpd -t
RHEL7/CentOS7 apachectl configtest
httpd -t
RHEL6/CentOS6
RHEL5/CentOS5
/etc/init.d/httpd configtest
service httpd configtest


Configuration

Ubuntu

/etc/apache2/apache2.conf
/etc/apache2/envvars
/etc/apache2/ports.conf
/etc/apache2/conf-available
/etc/apache2/conf-enabled
/etc/apache2/mods-available
/etc/apache2/mods-enabled
/etc/apache2/sites-available
/etc/apache2/sites-enabled
Directory Disable Command Enable Command explanation
/etc/apache2/conf-available
/etc/apache2/conf-enabled
a2disconf a2enconf
/etc/apache2/mods-available
/etc/apache2/mods-enabled
a2dismod a2enmod
/etc/apache2/sites-available
/etc/apache2/sites-enabled
a2dissite a2ensite Virtual host Configuration

Performance

ConfigurationNote
HostnameLookups Off Log the names of clients or just their IP addresses

How to Check

Security

Dissable Apache Signature and Banner

ConfigurationNote
ServerTokens Prod This directive configures what you return as the Server HTTP response Header
Prod or ProductOnly
Prod displays “Server:Apache”
ServerSignature Off Optionally add a line containing the server version and virtual host name to server-generated pages
TraceEnable Off The 'HTTP TRACE' request is used as a debugging tool eo echo all the received information.

Disable directory Indexing

<Directory /var/www/html>
  Options -Indexes
</Directory>

Restrict Access to 'Root' directory

<Directory />
  Options None
  AllowOverrride None
  Order allow,deny
  Allow from all
</Directory>