# Apache HTTP Server

> The long-standing web server still common in legacy stacks, shared hosting and PHP applications. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/devops/apache
Last updated: 2026-11-28

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](https://www.internhack.in/roadmaps/tracks/devops/web-server-concepts)

**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](https://www.internhack.in/roadmaps/tracks/devops/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](https://www.internhack.in/roadmaps/tracks/devops/caddy): A modern web server with automatic HTTPS and a very short config format, great for small teams and simple deployments.
- [HAProxy](https://www.internhack.in/roadmaps/tracks/devops/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

- [Apache HTTP Server documentation](https://httpd.apache.org/docs/) (Apache)
- [Apache getting started](https://httpd.apache.org/docs/current/getting-started.html) (Apache)

Previous: [HAProxy](https://www.internhack.in/roadmaps/tracks/devops/haproxy) · Next: [Containers and Docker Basics](https://www.internhack.in/roadmaps/tracks/devops/container-fundamentals)

## More in Web Servers and Reverse Proxies

- [How Web Servers Serve Traffic](https://www.internhack.in/roadmaps/tracks/devops/web-server-concepts)
- [Nginx](https://www.internhack.in/roadmaps/tracks/devops/nginx)
- [Caddy](https://www.internhack.in/roadmaps/tracks/devops/caddy)
- [HAProxy](https://www.internhack.in/roadmaps/tracks/devops/haproxy)
- [Apache HTTP Server](https://www.internhack.in/roadmaps/tracks/devops/apache)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
