They're Both Fine — That's Not the Answer You Wanted
Nginx vs Apache is one of those debates that has been running so long it's become almost ritualistic. The honest answer is that both are battle-tested, both can handle serious traffic, and for most use cases, the difference in performance under normal load is not the bottleneck you should be worrying about. But the differences are real, and they do matter depending on what you're building.
How They Handle Connections Differently
Apache uses a process-per-connection or thread-per-connection model (depending on configuration). It's straightforward conceptually, and each request has its own context. The problem is that under high concurrency — thousands of simultaneous connections — this model consumes a lot of memory and CPU.
Nginx was designed from the start with an event-driven, asynchronous architecture. It handles many connections within a single thread using non-blocking I/O. This makes it significantly more memory-efficient under high concurrency, which is why it became the default choice for serving static files and acting as a reverse proxy at scale.
In practice: if you're running a server that mostly serves static assets or proxies to backend applications, Nginx will handle spikes more gracefully. If you're running a PHP application using Apache's mod_php, the tight integration can simplify your stack considerably.
Dynamic Content: Where Apache Has the Edge
Apache's module system — specifically mod_php — embeds PHP directly into the web server process. For traditional PHP apps, this means less complexity: PHP runs inside Apache, requests are handled in-process, and the configuration is relatively simple.
Nginx doesn't have built-in PHP support. You need PHP-FPM running as a separate process and Nginx configured to forward requests to it. That's one more moving part, one more thing to configure correctly. For simple shared hosting setups, Apache's approach is genuinely easier. For production environments where you want PHP-FPM anyway for better resource control, the difference largely disappears.
.htaccess: Flexibility vs Overhead
Apache supports .htaccess files — per-directory configuration that lets you override server settings without touching the main config. This is hugely useful in shared hosting environments where users don't have server-level access. WordPress rewrites, custom redirects, auth rules — all of it works through .htaccess.
Nginx doesn't support .htaccess. All configuration lives in the main config file. This is actually a performance win (no per-request filesystem checks to find .htaccess files), but it means configuration changes require server-level access and a reload. For managed environments, this matters. For your own VPS, it rarely does.
The Modern Reality: They Often Work Together
It's worth noting that in a lot of production setups, the choice isn't Nginx OR Apache — it's Nginx in front of Apache. Nginx handles SSL termination, static files, and load balancing; Apache handles the dynamic PHP processing in the back. This hybrid approach is common in hosting environments precisely because it plays to each server's strengths.
If you're starting fresh on a VPS with a modern stack (Node, Python, Go), Nginx is the natural choice for its simplicity as a reverse proxy. If you're inheriting a PHP/Apache setup or working in shared hosting, there's nothing wrong with sticking with Apache — the "Nginx is always better" sentiment doesn't hold up under scrutiny.