2024年09月27日 建站教程
nginx如何禁止访问指定目录下的所有文件和目录,下面web建站小编给大家详细介绍一下具体实现代码!
nginx配置如下:
server {
listen 80;
server_name www.lmcjl.com;
location / {
root html;
index index.php index.html index.htm;
}
//禁止访问单个目录
location ~ ^/(static)/ {
deny all;
}
location ~ ^/static {
deny all;
}
//禁止访问多个目录
location ~ ^/(static|js) {
deny all;
}
}
本文链接:http://so.lmcjl.com/news/14050/