Skip to main content

Apache HTTP Server

Apache HTTP Server (commonly called Apache) is one of the oldest and most widely used web servers. First released in 1995, it powers a significant portion of websites worldwide and is known for its flexibility and extensive module system.

Key Features

  • Module system: Extend functionality with 500+ available modules
  • Virtual hosts: Serve multiple domains from one server
  • .htaccess: Per-directory configuration without server restart
  • URL rewriting: Powerful mod_rewrite for URL manipulation
  • Cross-platform: Runs on Linux, Windows, macOS

Common Modules

ModulePurpose
mod_rewriteURL rewriting and redirection
mod_sslHTTPS/TLS support
mod_proxyReverse proxy and load balancing
mod_phpPHP processing
mod_securityWeb application firewall
mod_deflateCompression
mod_headersCustom HTTP headers

Configuration Example

<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example

<Directory /var/www/example>
AllowOverride All
Require all granted
</Directory>

# Redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>

Apache vs Nginx

AspectApacheNginx
ArchitectureProcess/thread per connectionEvent-driven, async
Memory usageHigherLower
Static filesGoodExcellent
Dynamic contentNative (mod_php)Proxy to PHP-FPM
Configuration.htaccess flexibilityCentralized only
Market shareDecliningGrowing

What We Like

  • Flexibility: .htaccess allows per-directory configuration
  • PHP integration: Native mod_php is simple to set up
  • Documentation: Decades of community knowledge
  • Stability: Battle-tested and reliable

What We Don't Like

  • Performance: More resource-intensive than Nginx
  • Complexity: Configuration can become unwieldy
  • Modern workloads: Not optimised for WebSockets, high concurrency
  • Declining relevance: Nginx and cloud services taking over

When to Use Apache

  • Legacy applications expecting Apache features
  • WordPress and PHP applications needing .htaccess
  • Shared hosting environments
  • When mod_rewrite rules are already written

Modern Alternatives

For new projects, consider: