How to Block Access to Files with a Specific Extension in Nginx
Sometimes for security reasons, we want to block user access to files with specific extensions. Below we’ll cover the blocking method in Nginx; once configured, front-end access will directly return a 403 status code.
Sample code is as follows:
location ~ .*/.(jsp|php|asp|aspx|sql|dmp)$ {
…