# Apache HTTP Server

> Work with Apache httpd, still common in PHP hosting, legacy stacks and enterprise environments. Free notes, key concepts, resources and a mini project.

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

Work with Apache httpd, still common in PHP hosting, legacy stacks and enterprise environments.

Intermediate · about 3 hours · difficulty 2/5

Learn first: [Reverse Proxies and Load Balancers](https://www.internhack.in/roadmaps/tracks/backend/reverse-proxies-load-balancers)

**Apache HTTP Server** (httpd) was the web's dominant server for decades and still runs a large share of sites, especially shared PHP hosting, WordPress installs and older enterprise systems. You are likely to meet it when maintaining existing infrastructure.

### Key ideas

- **Virtual hosts** (`<VirtualHost *:443>`) serve multiple sites from one server.
- **Modules** add features: `mod_ssl` for TLS, `mod_rewrite` for URL rewriting, `mod_proxy` and `mod_proxy_http` for reverse proxying, `mod_headers` for response headers.
- **MPMs** (multi-processing modules) decide the concurrency model: `prefork` (process per connection, needed by old mod_php setups), `worker` and `event` (threaded, much more efficient). Use `event` with PHP-FPM for modern deployments.
- **.htaccess** files allow per-directory configuration without touching the main config. Convenient on shared hosting, but slower, since Apache checks for them on every request.

### As a reverse proxy

`ProxyPass "/api" "http://127.0.0.1:3000/"` and `ProxyPassReverse` forward traffic to an app server, and `mod_proxy_balancer` spreads load across several.

### Operating it

Test with `apachectl configtest` before reloading, and read `error_log` first when something fails. Rewrite rules are powerful but hard to debug; keep them few and commented.

### When to choose it today

For new projects Nginx or Caddy are usually simpler and more efficient. Apache remains a reasonable choice when you need `.htaccess` compatibility, specific modules, or when your organization already standardizes on it.

You are ready to move on when you can set up a virtual host with TLS that proxies to your app and explain why the event MPM beats prefork for concurrency.

## Key concepts

- **Virtual hosts**
- **Core modules: ssl, rewrite, proxy**
- **MPMs: prefork, worker, event**
- **.htaccess files**
- **PHP-FPM integration**
- **mod_proxy_balancer**

## Other options for this step

- [Nginx](https://www.internhack.in/roadmaps/tracks/backend/nginx): Configure the most widely deployed web server and reverse proxy for your backend.
- [Caddy](https://www.internhack.in/roadmaps/tracks/backend/caddy): Use Caddy for a reverse proxy with automatic HTTPS and a tiny, readable configuration.

## Mini project

Configure Apache with a TLS virtual host that serves static files and proxies /api to your backend, then move a rewrite rule from .htaccess into the main config.

## Check yourself

Why do .htaccess files slow Apache down, and when are they still worth using?

## Free resources

- [Apache HTTP Server documentation](https://httpd.apache.org/docs/current/) (Apache)
- [Apache: Reverse Proxy Guide](https://httpd.apache.org/docs/current/howto/reverse_proxy.html) (Apache)

Previous: [Caddy](https://www.internhack.in/roadmaps/tracks/backend/caddy) · Next: [Monoliths and Modular Monoliths](https://www.internhack.in/roadmaps/tracks/backend/monolith-modular)

## More in Containers, Orchestration and Web Servers

- [Containers with Docker](https://www.internhack.in/roadmaps/tracks/backend/docker)
- [Kubernetes Basics for Backend Developers](https://www.internhack.in/roadmaps/tracks/backend/kubernetes-basics)
- [Reverse Proxies and Load Balancers](https://www.internhack.in/roadmaps/tracks/backend/reverse-proxies-load-balancers)
- [Nginx](https://www.internhack.in/roadmaps/tracks/backend/nginx)
- [Caddy](https://www.internhack.in/roadmaps/tracks/backend/caddy)
- [Apache HTTP Server](https://www.internhack.in/roadmaps/tracks/backend/apache-httpd)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Backend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/backend)
