Fixing a 404 Not Found Nginx Error

404 not found nginx

What Does a 404 Not Found Error Mean?

A 404 Not Found error occurs when a user is trying to access an asset that either does not exist or has been moved. This commonly occurs when a permalink has been modified and no 301 redirect was put in place to redirect the user to the correct URL. There are a multiple variations of the 404 error which you might see dependant upon which server you are using. A few examples include:

  • 404 Not Found
  • Page Does Not Exist
  • 404 Not Found Nginx
  • Error 404
  • Not Found
  • HTTP Error 404

How to Fix a 404 Not Found Nginx Error

If you’re receiving a 404 Not Found Nginx error and have double checked that the asset(s) does in fact exist on your server, then there may be an issue with your configuration file. To check this, open your nginx.conf file and check if your site is using the correct path for the root folder. For example:

location / {
    root /var/www/yourwebsite;
}

If the path is not correct, this could be the reason why your assets are returning a 404 Not Found Nginx error. Additionally, check the rewrite rules in your configuration file to ensure they aren’t misconfigured. A slight misconfiguration of a rewrite rule will change the URL to point to an incorrect path thus resulting in a Not Found error.

Tools to Check For 404 Not Found Errors

Apart from fixing internal 404 Not Found errors, you may also be linking to external resources that have been updated or removed. In this case, it is important to regularly perform 404 error checks to verify that your links aren’t broken. Regularly checking this and fixing any broken links will help ensure that you visitors’ user experience is not degraded by pointing them to a link that doesn’t work. A few tools you can use to check for 404 Not Found errors include the following:

  • W3C Check Link – This site allow you to simply enter your website URL and it will scan all of your pages looking for 404 Not Founds as well as other errors. Once the scan is complete, it will return the results along with the URLs which appear to be broken.
    w3c check link
  • Check My Links (Chrome extension) – The check my links Chrome extension is a simple extension which allows you to check the links of the current webpage you’re viewing. Once enabled, the extension will crawl the links on the page and will determine is they are valid or broken.
    check my links extension
  • Broken Link Checker (WordPress Plugin) – This WordPress plugin provides users with many options for checking if your website has any broken links. A time period can be define that tells the plugin to check if existing links are broken every X hours. You can also define wether you want the plugin to send an email report of all broken links, choose which sections of your site to scan, etc. broken link checker wordpress

If you’re experiencing a 404 Not Found Nginx error or rather just want to monitor your site to ensure none of the URLs have been modified, use the methods above to help ensure your website links remain accessible.

Leave A Comment?