location 禁止多目录
2024-10-19 03:19:55
[root@web01 default]# mkdir cron templates
[root@web01 default]# tree
.
├── cron
└── templates directories, files
[root@web01 default]# tree
.
├── cron
│ └── index.html
└── templates
└── index.html directories, files
[root@web01 default]# cat cron/index.html
i am cron
[root@web01 default]# cat templates/index.html
i am templates
[root@web01 default]#
[root@web01 templates]# curl http://192.168.1.24/cron/
i am cron
[root@web01 templates]# curl http://192.168.1.24/templates/
i am templates
[root@web01 templates]# cat /app/server/nginx/conf/rewrite/default.conf
#rewrite ^/index\.html /index.php last;
#if (!-e $request_filename) rewrite ^/(.*)$ index.php last;
#if (!-e $request_filename) {rewrite ^/(.*)$ /index.php last;}
#if (!-e $request_filename) {return 404;}
#if ($http_user_agent ~ Firefox) {rewrite ^(.*)?$ /nginx-Firefox/$1 break;}
#if ($http_user_agent ~ MSIE) {rewrite ^(.*)$ /nginx-MSIE/$1 break;}
#rewrite ^/(\d+)/(.+)/ /$/$ last;
location ~ ^/(cron|templates)/ {deny all;break;}
[root@web01 templates]# curl http://192.168.1.24/cron/
<html>
<head><title> Forbidden</title></head>
<body bgcolor="white">
<center><h1> Forbidden</h1></center>
<hr><center>nginx/1.4.</center>
</body>
</html>
[root@web01 templates]# curl http://192.168.1.24/templates/
<html>
<head><title> Forbidden</title></head>
<body bgcolor="white">
<center><h1> Forbidden</h1></center>
<hr><center>nginx/1.4.</center>
</body>
</html>
最新文章
- wpf 悬浮窗口的实现
- .cn根服务器被攻击之后
- CheckBoxList控件获取多选择,需要遍历
- PKU 1003解题
- Ubuntu操作系统安装使用教程 (转)
- Java 8新特性——default方法(defender方法)介绍
- Commando War
- XCode环境变量及路径设置
- EF Code-First数据迁移的尝试
- Netsharp快速入门(之2) 基础档案(之A 创建插件和资源)
- 物联网操作系统HelloX已成功移植到MinnowBoard MAX开发板上
- WRS是什么?
- 进程隐藏与进程保护(SSDT Hook 实现)(一)
- HDU_2019——向排序好的数列中插入数
- swift 用协议实现代理传值功能
- Swift - 操作表(UIActionSheel)的用法,也叫底部警告框
- [C#基础] 委托
- java代码实现简单的认证——图片验证码形式
- loj6070【山东集训第一轮Day4】基因
- 011-JDK可视化监控工具-Jstat