Nginx serves static assets and forwards PHP requests to PHP-FPM. A routing problem, unavailable PHP socket and application exception can all look like a broken site to a visitor.
Implementation approach
Confirm the document root points to the application’s public directory, use the correct PHP-FPM socket, and restrict direct PHP execution according to the application deployment pattern.
Example
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Validation and edge cases
Inspect Nginx access and error logs and the PHP-FPM service journal. Validate configuration with nginx -t before reloading, and confirm sensitive files outside the public root cannot be requested.
Key takeaway
Keep application, web server and worker failures observable separately; avoid changing several configuration layers at once.




