In this post, I will show you how we can Ignore or exclude specific files or folder from NGINX configuration.


Before we start updating the configuration file I hope you have good knowledge of the NGINX server because if something goes wrong in the config file your site goes down, and to update configuration file you need complete access of server.

Steps to update the NGINX Configuration file

Step 1. Login to the server via terminal or putty.

Step 2. Go to cd /etc/nginx location and open you site configuration file nano

Step 3. Open file is open for the edit you can ready to change the setting. Now if you only want to allow specific files to ignore then you can change setting like this.

In my case, I want to ignore the manifest.json file and pwabuildersw.js file so I can update my configuration as shown in the above code.

Step 4. If you want to ignore a specific folder you can do like this.

In my case, I want to ignore assets folder.

Step 5. If you want to ignore both folder and specific file then you can do like this as shown in the below code.

Step 6. Save your file by pressing ctrl+o and exit ctrl+x.

Step 7. Reload your NGINX configuration sudo systemctl reload nginx.

That’s it now you can check your site. I hope you understand how to Ignore specific files and folders in NGINX server.