Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
NGINX Technical Guide

NGINX Home Page Loads But Other Pages Return 404

The NGINX 404 error often stems from a file not being present, rather than its actual absence, incorrect document root, server_name, root/alias usage, or a missing try_files rule for a front-controller. This guide covers WordPress, Laravel, and SPA scenarios separately.

404 Not Foundtry_filesroot vs aliasWordPressLaravel
root@server:~SSH
2026/07/17 03:48:20 [error] 2307#2307: *912 open() "/usr/share/nginx/html/product/42" failed (2: No such file or directory)
GET /product/42 HTTP/2.0 404
Request flowClient, NGINX, and backend connection break point
ConfigurationValidation of active server and location blocks
Live diagnosisLog, socket, port, and service controls
Secure ApplicationTest, controlled reload and result verification
01
Technical description

What does an NGINX 404 and try_files error mean?

NGINX maps the request URI to a file/directory path in the active server and location block. Incorrect matching or missing fallback results in a 404 even if the application route exists.

If the home page opens and subpages give 404, the try_files rule in location / is the first suspect in WordPress/Laravel-like front-controller applications.

The root directive appends the specified root URI; alias, on the other hand, modifies the matching location section in a different way. If regex location is used without caution, the file path will be calculated incorrectly.

If the server_name does not match, the request may fall back to the default server block. In this case, even if the correct files are present on the server, a 404 may be seen from another document root.

In SPA applications like React/Vue, a fallback to index.html is required when a real static file is not found; API and static asset locations should be separated from this fallback.

Do not hide 404 by forcing all requests to index.php or index.html; static file, API, and non-existent URL behavior should remain separate.

02
Log messages and their meanings

404, try_files, and document root messages

Search for the phrase you see in the email, browser, or SSH log. Each card includes meaning, probable cause, and safe initial action.

8 registration
01kritik

open() ... failed (2: No such file or directory)

Meaning: NGINX could not find the source on the file path calculated by NGINX.

Possible cause: Incorrect root/alias or missing file.

Compare the full path with the actual deployment path in the log.
02kritik

404 Not Found nginx

Meaning: Matching file or fallback not found

Possible cause: try_files, location, server_name, or application route configurations.

nginx -T ile isteğin düştüğü server/location bloğunu belirleyin.
03warning

Primary script unknown

Meaning: The FastCGI script path does not correspond to the current PHP file.

Possible cause: SCRIPT_FILENAME, root or alias is mismatched.

Examine the fastcgi_param and $document_root values.
04warning

File not found.

Meaning: PHP-FPM script file not found.

Possible cause: NGINX and PHP-FPM chroot/path difference.

Verify and log the SCRIPT_FILENAME path sent by NGINX.
05warning

rewrite or internal redirection cycle

Meaning: Fallback is processing the same URI repeatedly.

Possible cause: Incorrect try_files or error_page target.

Check the fallback target and location for matching again.
06bilgi

WordPress permalinks 404

Meaning: Good links are not reaching index.php front-controller.

Possible cause: Eksik try_files $uri $uri/ /index.php?$args.

Verify the domain location / rule.
07bilgi

React refresh 404

Meaning: Client-side route is being searched as a file on the server directly.

Possible cause: SPA index.html fallback eksik.

Add index.html fallback, excluding API/static routes.
08bilgi

Laravel route 404 nginx

Meaning: Request is not pointing to public/index.php.

Possible cause: Document root is not project/public or try_files is missing.

set the root path to the public directory.

No records matching this expression were found.

03
Secure first review

SSH diagnostic commands and what output to look for?

Commands are for root access. Collect only status and logs first; Do not change the permanent setting without seeing the reason.

Active server and location blocks
nginx -T | grep -nE 'server_name|listen |root |alias |location |try_files|fastcgi_param SCRIPT_FILENAME'

Shows all directives affecting the request's path mapping.

Real file path.
realpath /var/www/example
find /var/www/example -maxdepth 2 -type f | head -n 50

Validates deploy directory and expected entry files.

Host header test
curl -sI -H 'Host: example.com' http://127.0.0.1/product/42
curl -skI https://example.com/product/42

Show the difference of default vhost with server_name.

404 logs
grep ' 404 ' /var/log/nginx/access.log | tail -n 50
tail -n 100 /var/log/nginx/error.log

Compares 404 URLs and calculated file paths.

URI and static file test
curl -skI https://example.com/
curl -skI https://example.com/olmayan-dosya.css
curl -skI https://example.com/uygulama-route

Tests front-controller and actual 404 behavior separately.

Test and reload
nginx -t && systemctl reload nginx

New route configuration is applied securely.

04
By hosting environment

Ubuntu/Debian, AlmaLinux/CloudLinux and Plesk controls

Although the root cause of the NGINX error is the same, package paths, service names, security layers and virtual host management vary depending on the Linux distribution or Plesk infrastructure used.

Ubuntu / Debian

Systemd, package path, and journald controls for NGINX 404 Not Found and try_files

  • First, verify the active NGINX configuration and service status.
  • Compare the domain error log with the systemd log in the same time range.
  • Run nginx -t before the change, then perform a graceful reload.
nginx -T | grep -nE 'server_name|root |alias |try_files' tail -n 100 /var/log/nginx/error.log

AlmaLinux / CloudLinux

SELinux, PHP-FPM pool, and RHEL-based service controls for NGINX 404 Not Found and try_files

  • Check the active status of NGINX and related backend services.
  • Review SELinux AVC records and security contexts.
  • Do not restart the service without passing the configuration test.
nginx -T | grep -nE 'server_name|root |alias |try_files' ls -Zd /var/www/example 2>/dev/null

Plesk Obsidian

NGINX virtual host files generated by Plesk: nginx 404 not found and try_files control.

  • Review the additional directives in the Domains > Apache & nginx Settings section.
  • Separate manually created and Plesk generated files.
  • If necessary, recreate the web configuration for the relevant domain only.
grep -R 'try_files\|root ' /var/www/vhosts/system/example.com/conf 2>/dev/null plesk repair web example.com -n
05
Safe solution order

NGINX 404 and try_files solution order

First, verify the correct virtual host, then the physical path and finally the application fallback.

1

Verify host and URL match

Check if the request fell into the correct server_name block.

curl -sI -H 'Host: example.com' http://127.0.0.1/
2

Find the log-calculated file path

Compare the path in the open() line with the actual deployment directory.

tail -n 100 /var/log/nginx/error.log
3

Review root and alias usage

Verify how the Location URI is converted to a file path.

nginx -T | grep -nE 'location |root |alias '
4

Check the front-controller rule

WordPress/Laravel routes should fall back to the appropriate index file.

nginx -T | grep -n 'try_files'
5

Test static, API, and application routes separately.

Verify that the fallback is not showing 200 for non-existent assets.

for p in / /api/health /olmayan.css /uygulama-route; do curl -sk -o /dev/null -w "$p %{http_code}\n" https://example.com$p; done
6

Test and apply controlled reload

After syntax, also clean and verify the cache/CDN layer.

nginx -t && systemctl reload nginx
06
Distinction by symptom

Special scenarios and decision trees

WordPress Permanent Links 404

location / requires index.php front-controller fallback.

nginx -T | grep -n 'try_files'
All Laravel routes return 404.

The document root should be the public directory of the project, not the project root.

nginx -T | grep -n 'root '; test -f /var/www/proje/public/index.php && echo OK
React/Vue refresh 404

Client route needs index.html fallback; API should be excluded.

curl -skI https://example.com/panel/montharlar
Static Files 404

Alias, case sensitivity, deploy path and build output are checked.

find /var/www/example -iname 'dosya.css'
Verify that the correct domain is showing another site.

server_name matching and default_server order are checked.

nginx -T | grep -nE 'listen .*default_server|server_name'
Plesk migration after 404

Web configuration and document root domain is recreated based on.

plesk repair web example.com -y

Absolutely don't

  • Do not redirect all 404s to index.php and show real lost files as 200.
  • Do not use root and alias directives with the same logic.
  • Do not move application files without checking the default server block.
  • Do not copy the Apache .htaccess rule for WordPress to NGINX.
  • Do not modify Plesk generated vhost files manually.

Post-solution verification

  • Verify that the correct domain is falling into the correct server block.
  • Home page and application routes return expected code.
  • The fake static file remains a 404.
  • PHP SCRIPT_FILENAME corresponds to the actual file path.
  • New error_log records do not have incorrect document root path.
07
Official technical resources

Official documentation of NGINX and related components

08
Internal SEO content set

Related NGINX error solutions

09
Frequently asked questions

NGINX 404 Not Found and try_files Curiosities about

NGINX home page is opening but why are other pages giving 404?

In front-controller applications, the try_files fallback inside location / is missing or incorrect.

try_files ne yapar?

Checks the specified files and directories in sequence; if not found, applies an internal redirect or error code to the URI in the last parameter.

What is the difference between root and alias?

Root appends the given path to the root request URI; alias replaces the matching location path with a different physical path.

What is the NGINX permalink rule for WordPress?

Usually the approach used is location / with try_files $uri $uri/ /index.php?$args; should be adapted to the existing structure and security rules.

How to solve Laravel NGINX 404?

The document root should be the public directory of the Laravel project and non-existent routes should be directed to public/index.php.

React refresh why 404 gives?

The browser directly requests the client-side route when needed, and NGINX searches for the real file. A controlled index.html fallback is required for SPAs.

What happens if the server_name is incorrect?

The request may fall on another or default server block and display a 404 or a different site via the wrong root.

EKA SOFTWARE AND INFORMATION SYSTEMS

Let's fix the error on your server permanently

By analyzing cPanel, WHM, CloudLinux, LiteSpeed, MariaDB, Exim and security layers together, we fix the root cause of the failure instead of just removing the service.

Get Server Support WhatsApp
Top