What is Nginx?

Nginx is a high performance web server used to serve websites and act as a reverse proxy. CloudSonic runs Nginx mainline on every server, configured and maintained by our team.

CloudSonic
CloudSonic
Last Updated September 10, 2026

TL;DR Nginx

Nginx, pronounced engine-x, is a high performance open source web server that also functions as a reverse proxy, load balancer, and HTTP cache. It was created in 2004 to solve a specific problem known as the C10K problem, which is the challenge of handling ten thousand concurrent connections on a single server. Unlike traditional web servers that create a new process or thread for each connection, Nginx uses an event-driven, asynchronous architecture that allows it to handle massive numbers of simultaneous connections with very low memory usage. Today Nginx powers a significant portion of the busiest websites on the internet. CloudSonic runs Nginx mainline, the latest stable release directly from nginx.org rather than the older version bundled with Ubuntu, on every server. It is configured with Brotli compression, FastCGI caching, rate limiting, and security headers out of the box, and it handles Cloudflare real IP passthrough so your logs always show accurate visitor data.

How Nginx Works

Nginx uses an event-driven, asynchronous, non-blocking architecture that is fundamentally different from the process-based model used by older web servers like Apache. When Apache receives a connection it spawns a new process or thread to handle it, which consumes memory and has an upper limit. Nginx instead uses a small fixed number of worker processes, each capable of handling thousands of simultaneous connections through an event loop. When a connection arrives, Nginx registers it as an event and handles it when resources are available, without blocking other connections in the meantime. This makes Nginx extremely efficient under high concurrent load. For a typical WordPress hosting setup, Nginx sits at the front of the stack receiving HTTP requests, handling SSL termination, serving static files directly from disk at high speed, and passing PHP requests to PHP-FPM via a reverse proxy configuration. It also manages the FastCGI cache which stores rendered PHP output so repeat requests can be served without invoking PHP at all.


server {
    listen 443 ssl;
    server_name example.com www.example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    include /etc/nginx/snippets/cloudflare-real-ip.conf;
    include /etc/nginx/snippets/fastcgi-cache.conf;

    root /var/www/example.com/public_html;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location = /xmlrpc.php {
        deny all;
    }

    brotli on;
    brotli_types text/plain text/css application/javascript application/json image/svg+xml;
}

Frequently Asked Questions on Nginx

Is Nginx better than Apache for WordPress?

For WordPress specifically, Nginx is generally considered the better choice for performance under load. Nginx's event-driven architecture handles high concurrency more efficiently than Apache's process-based model, particularly for serving static files and handling FastCGI cache responses. Apache has a larger ecosystem of per-directory configuration options via .htaccess files, but Nginx's server-level configuration is more performant and CloudSonic handles that configuration for you.

Can I access and modify the Nginx configuration on CloudSonic?

Yes. Because CloudSonic provides full root access, you can view and modify Nginx configuration files directly via SSH. CloudSonic uses a structured configuration layout with per-site configuration files, snippets for common settings, and a global configuration that applies to all sites. Changes require an Nginx reload to take effect, which can be done with a single command.

What is FastCGI cache in Nginx and how does it help WordPress?

FastCGI cache is a caching mechanism built into Nginx that stores the complete HTML output of PHP-generated pages on disk. When a cached page is requested, Nginx serves it directly without invoking PHP or querying the database at all. For a WordPress site serving primarily static content to logged-out visitors, FastCGI cache can reduce server response times from hundreds of milliseconds to single-digit milliseconds and eliminate the database entirely from the equation for cached requests.