Independent comparison · no paid rankings
Home / Blog / Nginx or Apache: choose by request paths, not reputation
Technical

Nginx or Apache: choose by request paths, not reputation

Nginx excels as a reverse proxy and for static files; Apache still shines with .htaccess and legacy modules. The right choice is read request by request.

5 min read Updated Jul 19, 2026

“Let's switch to Nginx” shows up in every audit — sometimes for good reasons, sometimes because a 2014 blog post said so. Yet shared-hosting Apache still runs thousands of WordPress sites without urgency thanks to .htaccess. And modern stacks run nginx in front of Apache precisely because nobody migrated the rules.

Nginx and Apache are not two religions. They are two points on the request path with different strengths. Picking “the best” without mapping HTTP → PHP → static → cache means optimising the wrong layer.

Map the request path

Before comparing benchmarks, trace what happens when a visitor loads a page. Does the request hit a CDN first? Does the web server serve static files directly, or is everything handed to PHP? Who can change rewrite rules — engineering, or the client via .htaccess?

StepNginx roleApache role
TLS terminationExcellentOK (mod_ssl)
Static filesVery fast (sendfile)Adequate
App reverse proxyNative, lightmod_proxy
URL rewritingtry_files, maps.htaccess, mod_rewrite
PHPVia PHP-FPM upstreamPHP-FPM or mod_php
Directory basic authauth_basic.htaccess AuthType

The useful question: how much traffic hits the web server before PHP — and who must change rules without redeploying?

Three concrete scenarios

Scenario A — PHP-FPM SaaS, API + SPA

About seventy percent of assets go through a CDN. No client .htaccess. Need rate limiting and WebSocket proxy. Nginx alone (or nginx + CDN) is enough; Apache adds little.

Scenario B — Multi-client shared WordPress hosting

Per-site .htaccess rules, plugins that write rewrite rules, historical mod_php support. Apache is the natural fit — or nginx with manual rule conversion, which often underestimates migration cost.

Scenario C — Gradual transition

Legacy Apache + new Node app. Nginx front → Apache (port 8080) + Node (port 3000) by location block. Common when you cannot migrate everything at once.

Performance: what benchmarks forget

Nginx wins on concurrent connections and static files. Apache with mpm_event + PHP-FPM stays competitive for moderate dynamic PHP. The bottleneck is usually PHP and MySQL, not the web server itself.

Measure before migrating: origin TTFB with and without cache, share of 304/200 static responses served directly by nginx, memory cost of mod_php versus PHP-FPM. Changing web servers without those numbers can mean weeks of work for five percent gain — while a missing SQL index is worth fifty.

Shared hosting, VPS, or PaaS

On shared hosting, Apache and .htaccess are often mandatory; nginx is rarely configurable. On a VPS, choice is free: nginx + PHP-FPM is recommended for a new project without .htaccess debt. On PaaS, an abstraction layer (Caddy, Traefik) hides the web server — you no longer really choose.

On a VPS, run one front unless you document a hybrid design — avoid nginx + Apache without reason (double TLS config, double failure surface).

For WordPress specifically, see Apache or nginx for WordPress. For a lighter stack, Nginx or Caddy.

The peak: reputation rarely replaces a request inventory

Changing web servers without profiling can mean weeks of migration for five percent gain — while a database index delivers fifty.

Decide and move forward without blind spots

In half a day you can decide cleanly. Trace ten representative requests (home, API, admin, asset). List .htaccess dependencies and required Apache modules. Measure TTFB to see if the web server is really the bottleneck. If you choose nginx, plan rule conversion and test 301 redirects. If you combine both, nginx should proxy only — one owner for configuration.

See Apache or nginx for WordPress and Nginx or Caddy. To pick underlying hosting, browse the directory and compare tool.

Frequently asked questions

Does Nginx always replace Apache?

No. Nginx is often better at the edge (TLS, cache, reverse proxy). Apache stays relevant with per-directory .htaccess, legacy mod_php, or modules without nginx equivalents. The right choice is in your stack, not the logo's reputation.

Best combination for modern PHP?

Nginx + PHP-FPM is the current standard. Apache + PHP-FPM works too. Avoid mod_php on busy production: workers mix web and PHP load, which complicates sizing.

Can you use both?

Yes. Nginx as reverse proxy in front of Apache or Node/Python apps is common in gradual migration. Document who terminates TLS and where rewrite rules live.

How to decide in 30 minutes?

List static traffic percentage, .htaccess need, required modules, and team skills. If 80% static/CDN + PHP-FPM → nginx front. If dozens of client .htaccess rules → Apache or nginx migration budget.


Choose Nginx or Apache by request path — not by the architecture slide logo.

Compare European hosts

Filter by compliance, location and use case — then open the sheets to verify the real scope.

Browse the directory
Blog

Related reading

All articles →