Apache HTTP Server (httpd) is the world's most widely used open-source web server, powering a significant share of the web since 1995 and continuously updated — Apache 2.4.67 (May 2026) is the current stable release. Its directive-based, modular architecture lets administrators configure everything from static file serving to complex multi-domain hosting with SSL/TLS, reverse proxying, load balancing, and automatic certificate management via ACME (mod_md). Understanding Apache's configuration hierarchy — server config → virtual host → directory → .htaccess — is the single most important mental model for avoiding unexpected behavior in production environments.
What This Cheat Sheet Covers
This topic spans 27 focused tables and 222 indexed concepts, 156 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Virtual Host Configuration
Name-based virtual hosting is the standard approach: a single IP serves many domains, with Apache routing by the Host header. IP-based virtual hosting is reserved for rare cases where TLS SNI is unavailable. Every virtual host should have its own ErrorLog and CustomLog to keep troubleshooting clean.
| Directive | Example | Description | |
|---|---|---|---|
<code><VirtualHost *:443></code>ServerName example.com</VirtualHost> | Defines a **named or IP-based virtual host** container; *:port` matches all IPs on that port for name-based hosting. | | |||
ServerName www.example.com | Canonical hostname used to identify the virtual host; essential for name-based routing and self-referential URL generation. | ||
ServerAlias example.com *.example.com | Alternate hostnames for the virtual host; wildcard patterns match multiple subdomains within one block. | ||
DocumentRoot "/var/www/html" | Root filesystem directory from which Apache serves files; must exist and be readable by the Apache process. | ||
ServerAdmin admin | Administrator email shown on server-generated error pages. | ||
ErrorLog "/var/log/httpd/error_log" | Error log file for this virtual host; use per-vhost paths for isolated troubleshooting. | ||
CustomLog "/var/log/httpd/access_log" combined | Access log path and format; combined includes referrer and User-Agent for detailed analytics. | ||
UseCanonicalName Off | Controls whether self-referential URLs use ServerName ( On) or the client's Host header (Off); Off is the default and correct for name-based virtual hosting. | ||
NameVirtualHost *:80 | • Apache 2.2 directive to designate an IP:port for name-based hosting • obsolete in Apache 2.4 where name-based virtual hosting is automatic. |