Apache HTTP Server

The long-standing web server still common in legacy stacks, shared hosting and PHP applications.

Intermediate · about 4 hours · difficulty 2/5

Learn first: How Web Servers Serve Traffic

Apache httpd powered much of the early web and still runs a large number of sites, especially PHP applications and older enterprise stacks. You are likely to inherit an Apache setup at some point.

What to learn

  • Virtual hosts in sites-available/sites-enabled (Debian) or conf.d (RHEL), enabled with a2ensite.
  • Modules such as mod_ssl, mod_rewrite, mod_proxy and mod_headers, enabled with a2enmod.
  • MPMs (prefork, worker, event) and how they affect memory and concurrency. Prefer event with PHP-FPM.
  • .htaccess files: convenient per-directory overrides, but slower and harder to audit than central config.
  • apachectl configtest before reloading.

Where it fits

Maintaining existing Apache deployments, WordPress and PHP hosting, and environments that rely on specific Apache modules. For new services, Nginx or Caddy are usually simpler.

Good enough to move on: you can set up a TLS virtual host with a rewrite rule and a reverse proxy, and explain the MPM in use.

Key concepts

  • Virtual hosts
  • mod_rewrite and mod_proxy
  • MPMs: prefork, worker, event
  • .htaccess trade-offs
  • PHP-FPM integration

Other options for this step

  • Nginx: The most widely deployed web server and reverse proxy; learn its config model and the handful of directives that cover most real setups.
  • Caddy: A modern web server with automatic HTTPS and a very short config format, great for small teams and simple deployments.
  • HAProxy: A high-performance TCP and HTTP load balancer known for reliability, fine-grained health checks and detailed stats.

Mini project

Host a small PHP app under Apache with the event MPM and PHP-FPM, a TLS virtual host, and a rewrite rule that forces HTTPS.

Check yourself

Why can heavy use of .htaccess files slow down an Apache server?

Free resources