Apache, NGINX or LiteSpeed: which web server for WordPress and PHP?
In this article9 sections
Every few months someone asks the same question: “Should I switch my WordPress server from Apache to NGINX, or to LiteSpeed? Everyone says it is faster.” The honest answer is that the web server is rarely the reason a PHP site is slow, and that the right choice depends less on benchmarks than on four practical things: who manages the server, whether your sites rely on .htaccess files, how you want to cache, and what control panel you use.
This guide explains what actually differs between the three, in plain terms, and ends with a recommendation for each common situation. It will also save you from the most common mistake: moving to a different web server for speed, then discovering that the real bottleneck was PHP, the database or the lack of a page cache.
What a web server does for a PHP site
Visitors connect to the web server. For images, stylesheets and scripts it sends the file. For PHP pages it hands the request to PHP, waits for the answer, and sends that back. So the web server’s job is mostly fast connection handling and passing work along, while PHP does the heavy lifting. This is why swapping the web server alone changes less than people expect, and why caching (so that PHP is not run at all for most visitors) usually matters far more.
Apache
Apache is the oldest and most widely deployed of the three. It is flexible, extremely well documented, and it understands .htaccess: small configuration files placed inside website folders that change behaviour per directory without touching the main configuration. WordPress, its plugins and many PHP applications ship rewrite rules, redirects and security rules as .htaccess content, and it simply works.
Strengths:
.htaccesssupport everywhere. Applications configure themselves; users on shared hosting can edit their own rules without root access.- A huge module ecosystem and decades of community answers.
- The default of many control panels, including cPanel (through EasyApache).
Trade-offs:
- Reading
.htaccesscosts time on every request, because Apache checks each folder along the path for the files. - Older configurations use a process model that needs more memory per connection. Modern setups use the event MPM together with PHP-FPM, which is much leaner (see the SiteHarbour guide to sizing Apache’s event MPM and PHP-FPM).
NGINX
NGINX is event-driven from the ground up: it handles many connections with few processes and little memory, and it is excellent as a web server and as a reverse proxy in front of applications. For PHP it passes requests to PHP-FPM.
Strengths:
- Low memory use and high concurrency on small servers.
- Excellent static file handling and reverse proxying (Node.js, Python and Laravel apps, load balancing).
- Built-in FastCGI caching, which can serve WordPress pages without running PHP (see the guide to NGINX FastCGI cache for WordPress).
Trade-offs:
- No
.htaccess. Every rule an application ships as.htaccessmust be translated into the server configuration, by someone with root access, and the server must be reloaded for changes. For a single site you control, this is fine and arguably cleaner. For a shared server where customers install software, it is a constant source of work. - Rules are configuration, so mistakes matter: a missing
try_filesor a forgotten deny rule can break pretty permalinks or expose files.
LiteSpeed
LiteSpeed is a drop-in alternative to Apache with an event-driven design. It comes in two editions, and the difference matters:
- LiteSpeed Web Server (Enterprise) is commercial. It reads Apache configuration and the large majority of Apache directives, including
.htaccessfiles, and picks up.htaccesschanges without a restart. Control panels such as cPanel and Plesk can use it in place of Apache. - OpenLiteSpeed is the free, open-source edition. It supports rewrite rules in
.htaccess, but not the full range of Apache directives, and it needs a restart to pick up changes to those files.
Both include LSCache, a page cache built into the server, and both support HTTP/3. The free LiteSpeed Cache plugin for WordPress uses that cache, and its server-level caching works only when the site runs on LiteSpeed. Some of its other features (image optimisation, CDN) use QUIC.cloud, LiteSpeed’s cloud service.
Strengths:
- Apache compatibility with better performance under load, with the Enterprise edition, which is why many hosting companies adopt it without asking customers to change anything.
- Integrated page cache and a mature WordPress plugin.
Trade-offs:
- Enterprise is licensed software, with a cost that scales with the server.
- OpenLiteSpeed behaves differently from Apache in ways that matter for
.htaccess-heavy sites, and its management is different from the Apache and NGINX you may already know. - Smaller community than Apache and NGINX; answers are harder to find.
Side by side
.htaccess: Apache yes; NGINX no; LiteSpeed Enterprise yes, OpenLiteSpeed partly (rewrite rules).- Page cache: Apache through WordPress plugins or modules; NGINX with FastCGI cache; LiteSpeed with LSCache.
- Memory under load: NGINX and LiteSpeed lean; Apache fine in the event MPM with PHP-FPM, heavier in older setups.
- Cost: Apache, NGINX and OpenLiteSpeed free; LiteSpeed Enterprise paid.
- Control panels: cPanel and Plesk support Apache; both can use LiteSpeed; Plesk commonly runs NGINX in front of Apache (check your version’s settings); NGINX-only setups are mostly for servers you manage by hand.
Which one should you use?
You run a shared or reseller server with cPanel or Plesk, and customers install their own software. Apache, or LiteSpeed Enterprise if the licence cost makes sense. Customer .htaccess files must keep working.
You have one or a few WordPress sites on a VPS you manage yourself. NGINX with PHP-FPM and FastCGI cache is a strong default, and costs nothing. OpenLiteSpeed with LSCache is a good alternative if you like its WordPress integration and web console.
You run Laravel, Node.js, Python or several apps behind one entry point. NGINX. Its reverse proxy and routing are what these setups need (see deploying Laravel on Ubuntu with NGINX and PHP-FPM).
The server is small (1 to 2 GB of memory). NGINX or LiteSpeed, with PHP-FPM sized carefully, and a page cache. Memory is your constraint, and the lean options help.
You inherited an Apache server that works. Leave it unless you have a measured reason. A migration to a new web server is a project with risk, not a free speedup.
Before you switch, measure
If speed is the reason, find out where the time goes first. Check the time to first byte for an uncached page and a cached page:
curl -s -o /dev/null -w "ttfb: %{time_starttransfer}s total: %{time_total}s\n" https://example.com/
If the uncached page takes 1.5 seconds and a cached one takes 0.05, the web server is not the issue: caching is. If every page is slow, look at PHP and the database first (see finding slow database queries). Do any comparison on a copy of the site, with the same PHP version and caching in both setups, otherwise you are comparing something else.
If you do move from Apache to NGINX
Plan these four things:
- Translate the
.htaccessrules. For standard WordPress the main rewrite becomes one line:location / { try_files $uri $uri/ /index.php?$args; }. Plugins that write rules (security, caching, redirects) need their rules converted by hand. - Recreate the protections
.htaccessprovided: deny access towp-config.phpbackups and dotfiles, and block PHP execution in the uploads folder. - Rebuild caching, headers and redirects in the NGINX configuration.
- Test on a staging copy and keep the old server until the new one has run for a week. See planning a server migration for the cutover method.
When it is worth getting help
The decision itself is simple; the work is in the details: translating rules, rebuilding the cache, and checking that nothing that used to work has quietly stopped. If you want a second opinion on what to choose, or you want the move done with a rehearsal and a rollback, I can help.
I work with Apache, NGINX, LiteSpeed, PHP-FPM and the control panels that sit on top of them. You can see my profile on Upwork, or read about WordPress and Laravel care.