Skip to main content
Back to Blog
Server & DevOpsAugust 20, 202510 min read

Nginx vs Apache: Performance Benchmark for 2026

A head-to-head performance benchmark comparing Nginx and Apache in 2026 across throughput, memory usage, and latency for static files, PHP, and reverse proxy workloads.

Introduction

The Nginx vs Apache debate has been running for over a decade, yet each year brings new versions and shifting performance characteristics. Apache 2.4 with its event MPM has closed the gap significantly, while Nginx continues to dominate in high-concurrency scenarios. Rather than relying on outdated benchmarks, we ran fresh tests on identical hardware with current stable releases to give you data you can trust.

All tests were performed on an AWS c6i.xlarge instance (4 vCPUs, 8 GB RAM) running Ubuntu 24.04 with kernel 6.8, using wrk and ab as load generators from a separate instance in the same availability zone.

Test Environment

# Versions tested
nginx -v    # nginx/1.26.1
httpd -v    # Apache/2.4.62

# Static file: 10 KB HTML page
# PHP workload: Laravel 11 welcome page via PHP-FPM 8.3
# Reverse proxy: upstream Node.js returning JSON

Static File Serving

For serving a 10 KB HTML file with 500 concurrent connections over 30 seconds:

| Metric | Nginx | Apache (event MPM) | |--------|-------|---------------------| | Requests/sec | 48,200 | 31,400 | | Avg latency | 1.2 ms | 2.8 ms | | Memory usage | 42 MB | 118 MB | | P99 latency | 4.1 ms | 12.6 ms |

Nginx handles static content with roughly 53 percent higher throughput and less than half the memory footprint. Its event-driven architecture avoids the per-connection overhead that Apache incurs even with the event MPM.

PHP-FPM Workload

Both servers were configured to pass PHP requests to the same PHP-FPM pool (pm.max_children = 50):

| Metric | Nginx | Apache (event MPM) | |--------|-------|---------------------| | Requests/sec | 1,840 | 1,720 | | Avg latency | 14.2 ms | 15.8 ms | | Memory usage | 48 MB | 132 MB |

The gap narrows here because PHP-FPM is the bottleneck, not the web server. Still, Nginx maintains a memory advantage and slightly better tail latencies.

Reverse Proxy Performance

Proxying to a Node.js upstream at 1,000 concurrent connections:

wrk -t4 -c1000 -d30s http://server/api/health

| Metric | Nginx | Apache (mod_proxy) | |--------|-------|---------------------| | Requests/sec | 22,600 | 14,100 | | Avg latency | 3.4 ms | 8.9 ms | | Memory usage | 55 MB | 210 MB |

Nginx excels as a reverse proxy, which is why it has become the default choice for load balancers and API gateways.

When to Choose Apache

Apache still makes sense when you need .htaccess per-directory overrides (shared hosting), rely heavily on mod_rewrite with complex rule sets, or use Apache-specific modules like mod_security with OWASP CRS.

Recommendations

For most modern deployments — especially containerized environments and high-traffic sites — Nginx is the better choice. For deeper server tuning strategies, read our post on SSH hardening for Ubuntu servers. Our server optimization service can help you get the most out of whichever web server you choose.

Nginx outperforms Apache across every workload we tested, with the largest gains in static file serving and reverse proxy scenarios. Apache remains a capable server, but if raw performance and memory efficiency are priorities, Nginx is the clear winner heading into 2026.

Need help with this?

Our team handles this kind of work daily. Let us take care of your infrastructure.