[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>

location 禁止多目录的更多相关文章

  1. 禁止指定目录执行php文件

    我们设置网站权限的时候,有些目录不得不设置让http服务器有写入权限,这样安全隐患就来了.比如discuz x2的 data目录,这个必须要有写入限,论坛才能正常运行,但有的黑客可能就会利用这个目录上 ...

  2. Nginx技巧——Nginx/Apache下禁止指定目录运行PHP脚本(转自运维之美)

    网站程序的上传目录通常是不需要PHP执行解释权限,通过限制目录的PHP执行权限可以提网站的安全性,减少被攻击的机率. 下面和大家一起分享下如何在Apache和Nginx禁止上传目录里PHP的执行权限. ...

  3. Nginx/Apache下如何禁止指定目录运行PHP脚本

    下面和大家一起分享下如何在Apache和Nginx禁止上传目录里PHP的执行权限. Apache下禁止指定目录运行PHP脚本 在虚拟主机配置文件中增加php_flag engine off指令即可,配 ...

  4. tomcat中如何禁止列目录下的文件

    tomcat中如何禁止列目录下的文件在{tomcat_home}/conf/web.xml中,把listings参数设置成false即可,如下: <servlet> <servlet ...

  5. nginx禁止访问目录中可执行文件

    某些网站系统需要用户上传图片等文件到某些目录下,难免程序有些漏洞,导致用户上传了php.cgi等等可执行的文件,导致网站陷入非常为难的境地. 此时我们可以通过nginx来禁止用户访问这些目录下的可执行 ...

  6. 禁止apache显示目录索引的常见方法(apache禁止列目录)

    禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思.下面说下禁止禁止Apache显示目录索引的常见的3种方法. 要实现禁止 ...

  7. 禁止apache显示目录索引 apache禁止列目录

    禁止Apache显示目录索引的常见的3种方法. 要实现禁止Apache显示目录索引,只需将Option中的Indexes去掉即可. 禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止 ...

  8. location 将跟目录下某个文件夹指向2级目录

    例如: /caffespressos/指向/web01/caffe/ [root@web01 default]# tree web01/ web01/ └── caffe └── index.html ...

  9. location 将多级目录下的文件转成一个文件

    /ck-135-201-7142.html 指向/ck/135/201/7142.html [root@web01 www]# cat /app/server/nginx/conf/rewrite/d ...

随机推荐

  1. 容器+AOP实现动态部署(四)

    上篇咱们介绍了容器和AOP的结合,结合后怎样将对象增强服务并没有过多的说明,这里将详细说明怎样将对象 进行增强 ,达到一个一对多和多对多的增强方式 先从简单的方式说起 /** *JDK代理类,实现动态 ...

  2. 使用HttpClient发送请求接收响应

    1.一般需要如下几步:(1) 创建HttpClient对象.(2)创建请求方法的实例,并指定请求URL.如果需要发送GET请求,创建HttpGet对象:如果需要发送POST请求,创建HttpPost对 ...

  3. 用IIS防止mdb数据库被下载

    如何防止mdb数据库被下载?本文讨论的是在服务器端禁止mdb格式数据库文件被下载,而不是在数据库中加入防下载表,将数据库名改为含#号的asp.asa等后缀格式. 下面以IIS6.0为例说明如何在服务器 ...

  4. Orchard运用 - 定制呈现最新博客文章

    每个博客系统为了吸引更多访问量,一般都会在首页或侧边栏列举一些最新文章/随笔以获取更多点击.其实也就是查询出最新的几篇文章并按照简练的方式呈现,比如一般都只有标题及其对应的链接,有时也会标注一下作者和 ...

  5. Tensorflow 之模型内容可视化

    TensorFlow模型保存和提取方法 1. tensorflow实现 卷积神经网络CNN:Tensorflow实现(以及对卷积特征的可视化) # 卷积网络的训练数据为MNIST(28*28灰度单色图 ...

  6. 十个书写Node.js REST API的最佳实践(上)

    收录待用,修改转载已取得腾讯云授权 原文:10 Best Practices for Writing Node.js REST APIs 我们会通过本文介绍下书写Node.js REST API的最佳 ...

  7. hdu 1158-Employment Planning,n*n*n

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1158 解题思路就不多说,动态规划. 值得提及的是题目没有给出数据范围,水过的都默认工人数目不超过100 ...

  8. [Functional Programming] Use Task/Async for Asynchronous Actions

    We refactor a standard node callback style workflow into a composed task-based workflow. Original Co ...

  9. [AngularJS] ng-change vs $scope.$watch

    <div class="form-group"> <label for="pwd">Password</label> < ...

  10. RMSE均方根误差学习笔记

    1.均方根误差,它是观测值与真值偏差的平方和观测次数n比值的平方根,在实际测量中,观测次数n总是有限的,真值只能用最可信赖(最佳)值来代替.方根误差对一组测量中的特大或特小误差反映非常敏感,所以,均方 ...