What Nginx Does
Nginx is the web server layer that receives HTTP and HTTPS requests. It decides which website should handle the request, serves static files and forwards dynamic application requests to the correct runtime.
Where Nginx Sits In The Stack
Nginx sits after DNS and before the application. DNS sends the visitor to the VPS. Nginx receives the request on that VPS and matches it against server blocks.
How Server Blocks Work
A server block tells Nginx which domain names it should answer, which directory contains the website files, which SSL certificate should be used and how PHP requests should be passed to PHP-FPM.
Why Nginx Matters
If Nginx is misconfigured, the wrong website may load, HTTPS may fail, redirects may loop, PHP files may not execute or visitors may see 403, 404, 502 or 504 errors.
Infrastructure Layer
Web Server
Difficulty Level
Beginner
Core Concept
Nginx is the web server that receives browser requests and routes them to the correct website, file or application runtime.
System Role
It acts as the front door of the VPS, handling HTTP, HTTPS, static files, redirects, SSL and PHP handoff to PHP-FPM.
How It Works
After DNS points traffic to the VPS, Nginx reads the request, matches the server_name, checks the root path and either serves a file or forwards PHP work to PHP-FPM.
Connected Components
DNS, VPS IP, Nginx server blocks, SSL certificates, website root directory, PHP-FPM socket, WordPress files, logs.
Common Failure Points
Duplicate server_name, wrong root path, missing SSL file, bad redirect rule, wrong fastcgi_pass, broken permissions, config reload without testing.
Verification Method
Test Nginx config before reload, check the active server block, verify HTTP status, inspect access logs and inspect error logs.
Basic Commands
nginx -t;
systemctl status nginx;
systemctl reload nginx;
curl -I https://example.com;
tail -n 50 /var/log/nginx/error.log