← Blog

Nginx vs Apache for PHP in 2026: which one to pick and why

The Nginx vs Apache debate has been around for years. In 2026 the answer isn’t the same as in 2018. Here’s when to pick each one and why benchmarks don’t tell the whole story.

The debate is still alive

"What’s better for PHP, Nginx or Apache?" is a question we’ve been answering for years in consulting. The honest answer is: it depends. And the right answer in 2026 has changed compared to 2018.

Let’s break it down.

How they work (short version)

  • Apache processes each request in a dedicated process or thread. With mod_php it runs PHP directly, which is convenient but consumes a lot of memory.
  • Nginx is asynchronous and offloads PHP to a separate process (PHP-FPM). This lets it serve thousands of concurrent requests with very little memory.

Under heavy static traffic, Nginx wins. Under very high concurrency with PHP, Nginx + PHP-FPM also wins, generally by a comfortable margin.

What changed in 2026

Apache has matured. Apache event MPM + PHP-FPM performs much better than the old mod_php. The gap with Nginx isn’t enormous any more in many cases, especially with medium workloads.

The choice today isn’t purely about performance, it’s about operations.

When to pick Apache

  • Shared hosting or sites with many .htaccess files: Apache handles them out of the box, no need to touch global config.
  • Older CMSes that come tuned for Apache (some WordPress plugins, certain PrestaShops).
  • Team that already knows Apache: switching to Nginx because it’s trendy and then not knowing how to operate the server is worse than running Apache properly.
  • Complex existing mod_rewrite rules that would take days to rewrite in Nginx.

When to pick Nginx

  • Heavy concurrent traffic: sites with high traffic peaks, especially if they serve a lot of static content alongside PHP.
  • Static or JAMstack sites: Nginx serves pre-rendered HTML effortlessly.
  • Memory-constrained servers: Nginx makes better use of limited resources.
  • Modern stacks with load balancers, reverse proxy, frontline caches.
  • WebSockets, HTTP/2 and HTTP/3: Nginx has excellent support and an easier configuration.

What matters more than the engine

In most real websites we see, the bottleneck isn’t Apache or Nginx: it’s a poorly configured PHP-FPM, MySQL with no indexes, unoptimised images or missing application cache.

Switching from Apache to Nginx and expecting the site to be twice as fast without touching anything else usually disappoints. It’s worth more to:

  1. Enable OPcache in PHP.
  2. Move PHP up to 8.3 or higher.
  3. Use object caching (Redis, memcached).
  4. Index the database properly.
  5. Serve images via CDN.

If after that you still hit performance issues, then it makes sense to rethink the front layer.

In both Apache and Nginx:

  • PHP-FPM (not mod_php).
  • HTTP/2 enabled and SSL certificate via Let’s Encrypt.
  • Brotli compression alongside gzip.
  • Proper cache headers for static files (1 year with immutable).
  • Slow query log enabled to spot DB bottlenecks.

Nginx vs Apache comparison table (with PHP-FPM, 2026)

AspectNginx + PHP-FPMApache (event MPM) + PHP-FPM
Concurrency modelAsynchronous, event-drivenHybrid (event MPM gets close, doesn’t match)
Static traffic performanceBetterGood
Medium PHP load performanceVery goodAlmost equivalent
Memory usageLowerHigher
Per-folder .htaccessNo (global config)Yes (handy on shared hosting)
Learning curveMediumLow (more classic docs)
Recommended for JAMstack/SSGYesBorderline
HTTP/2 + HTTP/3 supportExcellentGood
Complex inherited mod_rewrite rulesNeed rewritingWork as-is

When to pick each (summary)

ScenarioBest choice
New site with SSG/JAMstack and little PHP logicNginx
Site with very high concurrent trafficNginx
Small server with low memoryNginx
Reverse proxy in front of multiple backendsNginx
Shared hosting with many .htaccessApache
WordPress with very Apache-centric pluginsApache
Team that already knows Apache and everything worksApache
Old PrestaShop with complex mod_rewrite rulesApache

Frequently asked questions

Will switching from Apache to Nginx make my site twice as fast? Almost never. The bottleneck is usually PHP, the database or images, not the web server. Optimise PHP-FPM, OPcache and MySQL first.

Can I run both at the same time? Yes, it’s a common pattern: Nginx as the frontend serving static files and reverse-proxying to an internal Apache running PHP. You get the best of both.

What about Caddy or LiteSpeed? Caddy is excellent if you want automatic SSL with no config. LiteSpeed (Enterprise or OpenLiteSpeed) is very fast but less common in operations. Nginx and Apache are still the de-facto standards.

Is mod_php officially deprecated in 2026? For serious production, yes. PHP-FPM separates the lifecycle of the web server from PHP, which improves stability, security and performance.

Wrap-up

In 2026 there is no clear "winner" between Apache and Nginx for PHP. There is a more useful question: what does your team know and what runs better in production for you?

If you’re starting from scratch, Nginx + PHP-FPM is usually more resource-efficient and easier to configure for modern use cases. If you’re coming from Apache and everything works, don’t migrate just because of trends: invest that time in optimising PHP, the database and caching.

If you have a server with PHP that runs slow and you don’t know where to look, we can audit it for you, no strings attached.

Want to talk about your case?

Tell us what you need and we will get back to you within 24 hours with a clear proposal.

Get a quote