How To Fix Nginx Error 404 Not Found

In this guide, we intend to teach you How To Fix Nginx Error 404 Not Found.

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 redirects were put in place to redirect the user to the correct URL. There are multiple variations of the 404 error which you might see depending on 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

Steps To Fix Nginx Error 404 Not Found

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. 

Now follow the steps below to solve this problem.

Resolve 404 Error in Nginx

At this point, you need to open your Nginx configuration file with your favorite text editor, like the vi editor. In my case:

sudo vi /etc/nginx/nginx.conf

From there, 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. So, verify your path leading towards the asset directory.

Also, you need to check the rewrite rules in your configuration file to make sure 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.

Additionally, you can use some online tools for error checks.

Check “404 Not Found” errors with Online Tools

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.

Here are some online tools that you can use for error checks:

  1. W3C Check Link is a known application for verifying links on websites. It belongs to W3C’s validators and Quality Web tools. Its interface is unsophisticated and easy to use. W3C Link Checker automatically finds defects in links, anchors, HTML, and CSS elements and even gives recommendations about updating links.
W3C Link Checker

You have to enter your website URL, and it will scan all of your web pages for 404 Not Found error and other issues. When the scan is over, it will return all of the broken URLs along with other results.

2. Check My Links is a Chrome Extension that crawls your site in search of broken links. Its target audience is web designers, developers, and content creators.

Check My Links

When this plugin is activated, the extension will determine if the links on the current page are valid or broken

3. Broken Link Checker scans your page or the whole site and provides a broken links report within a few minutes. The report is generated directly without installing and running any additional program files. Then ‘Broken Link Checker’ highlights which links are functioning and which ones are broken.

Broken Link Checker

If you face a “404 Not Found” Nginx error or want to ensure that your website links are not broken or monitor your site, then utilize the above methods to fix it.

Conclusion

At this point, you have learned to Fix the 404 Not Found Nginx Error.

Hope you enjoy it.

Please subscribe to us on Facebook and Twitter.

2 COMMENTS
  1. It?¦s truly a great and useful piece of info. I am happy that you simply shared this useful information with us. Please stay us up to date like this. Thank you for sharing.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular