ScaleScaleScaleScale

Tips / Nginx


404 Not found error at Nginx

404 not found error may be one of the most popular error codes in the web history. But what does it exactly mean?

404 not found error using Nginx, Apache, Lighttpd or any other web server, means the file or page doesn’t exist. Simply as that.

What if the file exists in your web structure but you still see a 404 not found error?

Then, you are facing a configuration error at your Nginx server, it is probably located at your virtual site configuration. Some of the reasons could be that you are configuring a root folder that is not correct, this is done in this way:

location / {
    root   /var/www/mysite.com;
}

When, for example, the real path is:

location / {
    root   /var/www/html/mysite.com;
}

Incorrect or missing Rewrite Rules

In a lot of cases rewrite rules are tricky and can be a pain in the ass, so, check your rules to see if you are configuring correctly, remember that apache rules won’t work in Nginx, and for example, if you run a WordPress application in Nginx, and even if WordPress will generate and write the permalink structure in .htaccess file, Nginx can’t read .htaccess, so the result will be 404 not found error in Nginx.

Additional Resources

Popular search terms:

  • 404 Not Found nginx
  • nginx error
  • nginx 404
  • nginx 404 not found
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking

  • WTF? That’s it? That’s my mistake?! God damn it! HAHAHA Thanks for this article man! It saved me.

  • whatever i do no luck for me please help me… i’m using virtualmin with ubuntu. when i create a virtual server it created a location in root/home/sitename/public_html