The Nginx server sets methods to disable access to files or directories
- 2020-05-09 19:56:34
- OfStack
To disable a resource or category 1 in nginx, simply add an location and use deny all in it.
Access to files with an bat extension is disabled, as follows:
location ~* /.bat {
deny all;
}
Access to the configs directory, and all subdirectories or files under it, is disabled, as follows:
location ^~ /configs/ {
deny all;
}
Note that the above configs must be followed by a slash, otherwise all directories or files beginning with configs will be inaccessible.