Support

Find answers, guides, and tutorials to supercharge your content delivery.

Fixing a 404 Not Found Nginx Error

Updated on October 4, 2018
Fixing a 404 Not Found Nginx Error

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 dependent 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 Found errors as well as other errors. Once the scan is complete, it will return the results along with the URLs which appear to be broken.
  • Check My Links - This Chrome extension is a simple extension that 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.
  • Broken Link Checker - 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.

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.

KeyCDN uses cookies to make its website easier to use. Learn more