Skip to content

What Is Nginx? How It Works on a Cloudways Server With Apache and Varnish

On this page

Last updated: · By

In short: Nginx is a web server and also a reverse proxy: software that takes the request from the visitor and decides whether to return a file itself or pass the request on. On Cloudways it is the first layer on the server, with Varnish and Apache working behind it. I checked this on my own server on 7 Nov 2026, through the headers and error pages it returns.

⏱ Reading time: 8 minutes · Difficulty: Intermediate · Last checked against my server and the official documentation: 7 Nov 2026

In short: Nginx on a Cloudways server (as of 7 Nov 2026)

What it isA web server, reverse proxy, cache and load balancer, open source
Version on CloudwaysNginx 1.25.x, ports 80 and 443 (per KB 5116170)
Who else is in the chainVarnish 6.0.x (cache) and Apache 2.4.x, and PHP-FPM behind them
DefaultHybrid Stack (Nginx plus Apache). The alternative: Lightning Stack, Nginx only
What I measured on my serverPHP 8.4 on FPM, Apache 2.4 behind Varnish, Cloudflare in front
.htaccessWorks only when Apache is in the chain (Hybrid). On Lightning you use Web Rules

What is Nginx, and why is it on almost every server?

Nginx (pronounced “engine-x”) is open-source web server software. According to the official nginx site, it serves as an HTTP server, a reverse proxy, a caching layer, a load balancer and a mail proxy. It was originally written by Igor Sysoev and is distributed under a BSD license.

Its strength is handling many connections in parallel without using much memory. That makes it excellent in the role of the “doorman”: it receives every request, instantly returns static files such as images and CSS, and passes on to the layer behind it only what needs processing.

What is a reverse proxy, and how does it relate to Nginx?

A reverse proxy is a server that sits in front of another server and receives requests on its behalf. The visitor talks only to it, and it decides where to send each request and returns the response. In Nginx this is done with the proxy_pass directive, as described in the proxy module documentation.

On a WordPress server this means: Nginx handles the encrypted connection (HTTPS) and the files, and sends the PHP requests onward. That way the layers behind it do only the heavy work, and receive fewer requests.

How does Nginx work on a Cloudways server with Varnish and Apache?

On a Cloudways server with the Hybrid Stack, the request passes through several layers. According to the base packages article, Nginx serves static content, Varnish keeps copies of pages, and Apache runs the application. This is the order I saw on my server:

  1. Cloudflare (on my site, optional): receives the visitor at the edge of the network and can answer from its own cache.
  2. Nginx: the first layer on the server itself, on ports 80 and 443. It serves static files and blocks requests according to its own rules.
  3. Varnish: a cache of HTML pages. If a ready copy exists, the request goes no further. Details in the Varnish guide for Cloudways.
  4. Apache: reads .htaccess and passes the request to PHP.
  5. PHP-FPM and the database: this is where WordPress builds the page.

What did I see on my server on 7 Nov 2026?

I checked the chain in two ways, without changing anything on the server: reading the server variables from inside PHP (a read-only check), and curl requests from a computer in Israel, where I’m based. IP addresses and identifiers are not published here.

What I checkedWhat I sawWhat it means
The Server header in the response to a visitorcloudflareCloudflare hides the origin server, so from the outside you do not see nginx
SERVER_SOFTWARE from inside PHPApache 2.4 (Debian)PHP runs behind Apache, the last layer before the code
PHP interfacefpm-fcgi, version 8.4Apache hands off to PHP-FPM and does not run PHP inside itself
Headers that reached PHPX-Varnish, X-Real-IP, X-Forwarded-For, CF-Connecting-IPThe request went through Varnish and through a proxy that added the visitor’s real address
curl to /.htaccess403 with the word nginx at the bottomNginx blocks the file before the request reaches Apache
curl to /wp-content/uploads/403 from Apache, “Server at … Port 80”Apache refuses to show a directory listing

The last row is interesting: two different 403 pages on the same server, each from a different layer. It is the simplest way to tell who blocked you, and I covered it in the guide 403 Forbidden error: who is blocking and how to fix it.

Nginx or Apache: what is the difference, and which is better?

The big practical difference is the .htaccess file. Apache reads it in every directory, so WordPress plugins can write redirects and rules into it. Nginx does not read .htaccess, and all its settings live in the server configuration.

TopicNginxApache
Typical roleFront end: HTTPS, static files, reverse proxyRunning the application and reading per-directory rules
.htaccessNot supportedSupported, read on every request
Many parallel connectionsEspecially strongUses more resources
Changing settings without server accessNo, needs server configurationYes, through .htaccess
On CloudwaysAlways presentPresent in the Hybrid Stack, not in Lightning

There is no single winner here. The combination gives you both speed at the front and compatibility with plugins that write to .htaccess. The official Apache HTTP Server site documents this mechanism.

What is the Lightning Stack, and when should you switch to it?

The Lightning Stack is a mode where Nginx runs the application without Apache. According to the Cloudways article on changing the stack, in their load test (DigitalOcean Premium with 4 vCPU and 8GB, without Varnish and without an object cache) Lightning served 54% more requests and responded on average 19% faster.

That is a Cloudways measurement, not mine, and in a no-cache setup. On a site where most pages are served from cache, the difference you feel will be smaller. The switch is at the application level, so you can try it on one site on the server.

Before you switch, check .htaccess. The Cloudways article says explicitly that the main problem is 301 and 302 redirects or Rewrite rules written there. Move those first to Web Rules on Cloudways.

  1. Clone the application to a Staging environment and test there first.
  2. In the management panel, select the server and the application, then Application Management ← Application Settings.
  3. Open the Stack setting tab and choose Lightning Stack.
  4. Click Update Now and confirm with Proceed. According to Cloudways it takes about a minute, with no downtime.
  5. Check redirects, forms and the login page. If something breaks, go back to Hybrid on the same screen.
Black Friday80% off
80% off 2 months of managed hosting

The code BFCM802 takes 80% off your bill for the first two months (up to $200 off per month), including unlimited free site migrations. New customers only, and only until the offer ends.

The offer ends on December 4, 2026 at 23:59 (UTC+2).

Ends in—days—hours—minutes—seconds
Code:
Grab the 80% now

Start with a free trial, no credit card. Enter the code at checkout and check that it shows up.

After Black Friday: 30% off for 3 months with the code ASAEL. On a large server (above about $444 a month) ASAEL already saves more today. BFCM802 vs. ASAEL calculator

How do you check which server is answering you?

Three quick checks, from easiest to hardest. None of them changes anything on the site.

  1. The response headers: run the command below. If Server: nginx appears, you are talking directly to Nginx. If cloudflare appears, there is a CDN in front of the server.
  2. An error page: request a file that should not be accessible, such as /.htaccess. A page with nginx at the bottom shows that Nginx answered.
  3. From inside the server: over SSH run dpkg -l | grep nginx to see the installed version, as the Cloudways base packages article suggests.
curl -sI https://example.com/ | grep -iE "^(HTTP|server|x-cache|cf-cache-status)"
curl -s https://example.com/.htaccess | grep -i nginx

For server access, see the guide to connecting over SSH on Cloudways. Most settings that do not require SSH, such as upload size and execution time, you change in the server settings.

Why does Nginx return 403 to AI bots?

Because the platform’s Nginx blocked them by User-Agent, before WordPress was even involved. On my servers, until 6 Nov 2026, ClaudeBot, CCBot and Amazonbot received a 403 with the word nginx when the request reached the server, while GPTBot and PerplexityBot received 200. On 7 Nov 2026, after a ticket, Cloudways support removed the block, and since then all three bots get 200 (as of 7 Nov 2026).

One more thing I found before the removal: when the page was already stored in the Cloudflare cache, even ClaudeBot got 200, because the request never reached Nginx at all. So the same bot saw part of the site and not another part. The full story, including the ticket, the response time and a before-and-after test, is on the page how I got the ClaudeBot block removed on Cloudways.

Common mistakes with Nginx on Cloudways

Redirects in .htaccess that stopped working: this happened after a move to the Lightning Stack. Nginx does not read the file, so move the rules to Web Rules or go back to Hybrid.

“I changed a setting and nothing happened”: sometimes Varnish or Cloudflare returns an old copy. Purge the cache in both layers before you conclude that the setting does not work.

Looking for nginx.conf: there is no root access, so no direct editing. What you can configure in the panel is in Web Rules, and what you cannot goes to support.

Frequently asked questions

What is Nginx in simple terms?

Nginx (pronounced “engine-x”) is web server software that receives requests from the browser and returns pages and files. It can also pass requests to another server (a reverse proxy), keep copies in a cache and spread the load. It is open source and was originally written by Igor Sysoev.

What is the difference between Nginx and Apache?

Apache reads .htaccess files in every directory and lets you change settings without server access. Nginx does not read .htaccess, and its settings live in the server’s configuration files. On Cloudways the two work together: Nginx at the front and Apache behind it, unless you switch to the Lightning Stack.

Does Cloudways use Nginx?

Yes. According to the Cloudways base packages article, Nginx 1.25 is the front-end server on every server, on ports 80 and 443. The default for a new application is the Hybrid Stack, meaning Nginx plus Apache 2.4 and Varnish 6.0.

Can you edit nginx.conf on Cloudways?

Not directly, because there is no root access to the server. Redirects, rewrites and HTTP headers are set in Web Rules in the panel, and with the Hybrid Stack you can keep using .htaccess. A change to the Nginx configuration itself goes through a support request.

What is a 403 Forbidden with the word nginx at the bottom?

It is an error page that Nginx itself returned, before the request reached WordPress. On my server I saw it when accessing .htaccess and on requests from certain AI bots. If there is no nginx line at the bottom, the block probably came from another layer, for example Cloudflare or Apache.

Should you switch to the Lightning Stack?

It is worth testing, not switching blindly. According to Cloudways, the switch takes about a minute, with no downtime, and you can go back. If you have 301 redirects or special rules in .htaccess, move them to Web Rules first, otherwise they will stop working.

Sources

The measurements on this page: curl requests from my own computer and reading server variables from inside PHP, on the cw-servers.com server, 7 Nov 2026. A single measurement point, not a performance test.

Official source: Which Base Packages Are Deployed With a Cloudways Server (Cloudways Knowledge Base). Written and checked by Asael Dreyer · Updated: 7 Nov 2026

Disclosure: this is an independent site, not the official Cloudways site. Some links on this site are affiliate links: if you sign up through them we earn a commission, at no extra cost to you. Full details

Picture of Asael Dreyer
Asael Dreyer

Hi, I'm Asael Dreyer, CEO of an SEO agency that runs hundreds of websites hosted on dozens of Cloudways servers.
Everything you will find here comes from hands-on experience, mine and my teams', straight from the field: from the guides to the recommendations. All to help you get the most out of Cloudways.

More about me →

Need help? Got a question about your server or this guide? Write to us and we will get back to you.

More guides on this topic:
מפריד
Thanks for your message!
We will get back to you soon.
Ready to get started?

Sign up with the coupon code ASAEL