Introduction
Apache HTTP Server (httpd) is the web server that helped define the modern internet. First released in 1995, it remains one of the most widely deployed HTTP servers, powering millions of websites with a battle-tested architecture and an extensive module ecosystem.
What Apache HTTPD Does
- Serves static files, CGI scripts, and proxied dynamic content over HTTP/1.1 and HTTP/2
- Acts as a reverse proxy and load balancer for backend application servers via mod_proxy
- Provides URL rewriting and redirection through the powerful mod_rewrite engine
- Handles TLS termination with mod_ssl for HTTPS, including ACME certificate automation via third-party modules
- Supports virtual hosting to serve multiple domains from a single server instance
Architecture Overview
Apache HTTPD uses a modular, multi-processing architecture. The core handles connection management and delegates functionality to loadable modules (DSOs). Three Multi-Processing Modules (MPMs) are available: prefork (process-per-connection), worker (hybrid threads and processes), and event (async event-driven). Configuration is declarative, using httpd.conf and .htaccess files with a directive-based syntax. The module API allows extending nearly every aspect of request processing.
Self-Hosting & Configuration
- Install from your distribution's package manager or compile from source for custom module selection
- Edit
/etc/apache2/apache2.conf(Debian) or/etc/httpd/conf/httpd.conf(RHEL) for global settings - Use the event MPM for modern workloads; it handles keep-alive connections without blocking threads
- Enable mod_ssl and configure certificates for HTTPS; pair with certbot for automated Let's Encrypt renewals
- Place
.htaccessfiles in document roots for per-directory overrides (disable AllowOverride for better performance)
Key Features
- Over 80 official modules covering authentication, caching, compression, proxying, and security
- .htaccess files allow per-directory configuration without restarting the server
- Mature mod_rewrite engine provides regex-based URL manipulation used by most CMS platforms
- Virtual host support serves unlimited domains from a single instance with name-based or IP-based routing
- Proven stability under extreme load, with decades of production hardening
Comparison with Similar Tools
- Nginx — event-driven reverse proxy with a smaller footprint and simpler config syntax; Apache offers richer per-directory overrides via .htaccess
- Caddy — automatic HTTPS and simpler configuration; Apache provides a larger module ecosystem and deeper customization
- LiteSpeed — drop-in Apache replacement with better performance for PHP; Apache is fully open source with no commercial tiers
- Traefik — cloud-native reverse proxy with automatic service discovery; Apache is more traditional but more broadly deployed
FAQ
Q: Is Apache HTTPD still relevant compared to Nginx? A: Yes. Apache powers a large share of the web, especially where .htaccess support or specific modules (like mod_rewrite for WordPress) are needed.
Q: Which MPM should I use? A: Use the event MPM for most modern deployments. It handles thousands of concurrent connections efficiently using an async event loop.
Q: Can Apache act as a reverse proxy? A: Yes. Enable mod_proxy and mod_proxy_http to forward requests to backend application servers like Node.js, Python, or Java.
Q: How do I enable HTTPS? A: Enable mod_ssl, configure your certificate and key paths in a VirtualHost block, and optionally use certbot to automate certificate renewal.