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;
}