WordPress benchmark: Apache vs. Nginx



The performance of WordPress websites has always been a relevant topic – especially for those hosting their projects on low-power but energy-efficient devices like the Raspberry Pi 4.

Apache, historically the default web server in many Linux distributions, remains popular due to its simplicity and broad compatibility. However, in recent years Nginx has positioned itself as a faster and lighter alternative, particularly when handling a large number of concurrent connections.

In this article, I decided to compare these two web servers across several metrics such as First Contentful Paint, Largest Contentful Paint, Total Blocking Time, and Speed Index – key parameters commonly used in performance benchmarks.

Introduction

When I first deployed this blog, I used Apache as the default web server. Of course, WordPress “out of the box” is quite heavy, and over time, as I added more plugins, the site’s performance gradually declined. That made me curious to try Nginx.

Apache and Nginx work on fundamentally different principles, so a direct comparison isn’t always fair. However, using performance benchmarks provides an objective way to measure real-world results – and that’s exactly what this post explores.

Testing Methodology

To test website performance, I relied on two well-known benchmarking tools:

  • Google PageSpeed Insights
  • ApacheBench (ab)

Before migration, I ran each test three times – in the morning, afternoon, and evening – and then averaged the results. I repeated the same process under Nginx, and once again after additional Nginx optimization with FastCGI caching.

Let’s take a look at the results!

PageSpeed Insights тест

Google PageSpeed Insights is an online tool that evaluates web-page performance from the perspective of real-world users. It analyzes pages on both mobile and desktop, measuring key loading experience indicators known as Core Web Vitals:

  • Largest Contentful Paint (LCP) – time it takes to render the main visible content;
  • Total Blocking Time (TBT) – the period when the page remains unresponsive after load;
  • Cumulative Layout Shift (CLS) – visual stability during rendering;
  • plus additional metrics such as First Contentful Paint (FCP) and Speed Index.

Based on these measurements, PageSpeed Insights assigns a performance score and offers optimization recommendations. This helps assess not only server response speed but also the overall user experience.

Performance can vary depending on the device type – mobile and desktop. PageSpeed Insights displays the mobile result first, but you can switch to desktop view afterward. I averaged the data and visualized the results in comparative charts.

Mobile Results

Switching from Apache to Nginx alone gave a modest improvement – about 15 %. But after enabling FastCGI cache, the results changed dramatically:

  • the site began serving pages almost three times faster,
  • the main content (LCP) appeared in under 4 seconds,
  • and Total Blocking Time dropped by 40 %.

This improvement occurs because mobile devices have weaker CPUs and slower connections. Any form of server-side caching (Nginx FastCGI + Cloudflare Edge) has a significant effect: the browser no longer waits for PHP execution on the Raspberry Pi – it receives ready-made HTML instead.

Caching in Nginx turned out to be the most impactful optimization for WordPress on Raspberry Pi 4. The site moved from the “slow” category into a stable medium-to-fast range, and mobile visitors now see content roughly three times sooner than with Apache.

Desktop Results

On powerful desktop devices, the difference between Apache and Nginx is smaller, since browsers and network stacks process data faster than the Raspberry Pi can generate it. Here we can see:

  • FCP and LCP are nearly identical – the site already loads quickly;
  • TBT with caching drops to 15 ms, meaning the page renders instantly;
  • Speed Index in the cached version (1.3 s) is slightly worse than in the original (1.1 s).

Why? Speed Index measures how quickly the page becomes visually complete, not just the server response. In the cached setup, the browser receives content faster, but Cloudflare/Nginx may deliver it with slightly different headers (cache-control, content-encoding: zstd), which can alter the load order of small assets (CSS, JS, fonts). For a desktop user, this difference – a few tenths of a second – is statistically negligible and imperceptible in practice.

ApacheBench

ApacheBench (ab) is a command-line utility for measuring web-server performance. It simulates load by sending many concurrent requests and measures how quickly the server responds.

The test command:

ab -n 200 -c 50 https://ostrich.kyiv.ua/en/
  • -n 200 – total number of requests (200 pages in a row)
  • -c 50 – number of concurrent users (simulating 50 simultaneous visitors)

This test shows how well the Raspberry Pi 4 handles real load under Apache, Nginx, and Nginx with FastCGI cache.

Without caching, the difference between Apache and Nginx was minimal – both handled around 108–109 requests per second. Nginx was slightly faster at establishing connections (lower “Connect” time), but spent a bit more time processing PHP responses, resulting in roughly equal total throughput.

Enabling FastCGI cache, however, changed everything:

  • throughput increased from 109 to 141 requests per second,
  • average response time decreased by over 100 ms,

Each WordPress page is now served directly from Nginx cache, without invoking PHP, allowing the system to handle multiple simultaneous users quickly and consistently.

In short, the Nginx + FastCGI Cache combination turns a Raspberry Pi 4 into a lightweight yet production-grade web server, capable of sustaining WordPress workloads with dynamic content.

Conclusions

Switching from Apache to Nginx on Raspberry Pi 4 demonstrated that even a small home server can achieve a noticeable performance boost. Nginx alone proved slightly more efficient under high concurrency, but the real advantage came after enabling FastCGI cache.

Caching offloaded PHP and the database, making WordPress pages render almost instantly. This effect was most pronounced on mobile devices, where responsiveness improved severalfold and interactions became smoother.

On desktop systems, the improvement is less visible because modern browsers and connections are already fast – yet even there, Nginx with cache ensures more stable delivery and minimal rendering delay.

Overall, the combination of Nginx + FastCGI Cache + Cloudflare CDN transforms the Raspberry Pi 4 into a fully capable production-level web server – fast, stable, and optimized for modern performance standards.