What the message looks like
2026/10/29 09:41:03 [error] 1234#1234: *7788 open() "/var/www/example.com/html/about" failed (2: No such file or directory), client: 203.0.113.5, server: example.com, request: "GET /about HTTP/2.0", host: "example.com"Common causes
- The
rootoraliaspoints to the wrong directory, or the deployment did not put the files there. - An application with pretty URLs (front controller, single-page app) lacks
try_files ... /index.php?$argsor/index.html. - The request reached the wrong
serverblock (wrongserver_nameor thedefault_server). - File names are case-sensitive on Linux:
Logo.PNGis notlogo.png. - A
locationwithaliashas a trailing-slash mismatch, or a regex location overrides the intended one.
Check
- The exact path nginx tried
sudo tail -n 20 /var/log/nginx/error.log - The effective rules of the server
nginx -T 2>/dev/null | grep -nE 'server_name|root |alias |try_files|location ' - Does the file exist at that path?
ls -l /var/www/example.com/html/about - Which server block answers this host? (check the response)
curl -sI -H 'Host: example.com' http://127.0.0.1/about | head -n 5
Fix
- Compare the path from the error log with the real file location and correct
rootoralias, or deploy the missing files. - For front-controller apps use
location / { try_files $uri $uri/ /index.php?$args; }, for single-page appstry_files $uri /index.html;. - Check
server_nameso that the host matches the intended block, and set a deliberatedefault_server. - Fix the case of file names or links, and with
aliasmake the location and alias slashes match. - Test and apply:
nginx -t && systemctl reload nginx.
Typical scenario
You put an application's static files into a location: location /static/ { alias /var/www/app/static; } without a trailing slash. Every CSS file returns 404 although they exist. The error log shows the path /var/www/app/staticstyle.css: nginx appended the rest of the URL directly. So read the path actually tried from the log and compare it character by character with the real location.
FAQ
How is a 404 different from 403?
404 means nginx found no matching file. 403 means it found the path but may not read it or may not list the directory, which is a permission or index problem.
Can a 404 come from the application and not from nginx?
Yes. If PHP-FPM or a proxy backend answers 404, nginx only passes it on. The error log has no open() failed line in that case, so check the application routing.
What is the difference between root and alias?
With root nginx appends the complete URL to the path: /static/a.css becomes root/static/a.css. With alias the path replaces the location prefix: /static/a.css becomes alias/a.css. If the location ends in /, the alias path should end in / too.
Can upper and lower case be the reason?
Yes. Linux strictly distinguishes case, so Logo.PNG and logo.png are different files. On Windows or macOS development machines this goes unnoticed, and after deployment nginx returns 404. The path in the error log shows the exact spelling of the request.
How do I find out which server block handled the request?
Test with curl -I -H 'Host: example.com' http://127.0.0.1/path and compare with the call through the real name. nginx -T | grep -E 'server_name|listen' shows all blocks. A separate access log per server block shows immediately which one the request lands in.