location 禁止多目录
[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 禁止多目录的更多相关文章
- 禁止指定目录执行php文件
我们设置网站权限的时候,有些目录不得不设置让http服务器有写入权限,这样安全隐患就来了.比如discuz x2的 data目录,这个必须要有写入限,论坛才能正常运行,但有的黑客可能就会利用这个目录上 ...
- Nginx技巧——Nginx/Apache下禁止指定目录运行PHP脚本(转自运维之美)
网站程序的上传目录通常是不需要PHP执行解释权限,通过限制目录的PHP执行权限可以提网站的安全性,减少被攻击的机率. 下面和大家一起分享下如何在Apache和Nginx禁止上传目录里PHP的执行权限. ...
- Nginx/Apache下如何禁止指定目录运行PHP脚本
下面和大家一起分享下如何在Apache和Nginx禁止上传目录里PHP的执行权限. Apache下禁止指定目录运行PHP脚本 在虚拟主机配置文件中增加php_flag engine off指令即可,配 ...
- tomcat中如何禁止列目录下的文件
tomcat中如何禁止列目录下的文件在{tomcat_home}/conf/web.xml中,把listings参数设置成false即可,如下: <servlet> <servlet ...
- nginx禁止访问目录中可执行文件
某些网站系统需要用户上传图片等文件到某些目录下,难免程序有些漏洞,导致用户上传了php.cgi等等可执行的文件,导致网站陷入非常为难的境地. 此时我们可以通过nginx来禁止用户访问这些目录下的可执行 ...
- 禁止apache显示目录索引的常见方法(apache禁止列目录)
禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思.下面说下禁止禁止Apache显示目录索引的常见的3种方法. 要实现禁止 ...
- 禁止apache显示目录索引 apache禁止列目录
禁止Apache显示目录索引的常见的3种方法. 要实现禁止Apache显示目录索引,只需将Option中的Indexes去掉即可. 禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止 ...
- location 将跟目录下某个文件夹指向2级目录
例如: /caffespressos/指向/web01/caffe/ [root@web01 default]# tree web01/ web01/ └── caffe └── index.html ...
- location 将多级目录下的文件转成一个文件
/ck-135-201-7142.html 指向/ck/135/201/7142.html [root@web01 www]# cat /app/server/nginx/conf/rewrite/d ...
随机推荐
- Pydoc 本地 HTML 形式查看
Pydoc 本地 HTML 形式查看 我们在编写Python代码时,常常会去查询某些模块及函数的使用,会选择 dir() 及 help() 函数.或查看 CHM 格式的Python帮助文档.或查看Py ...
- Oracle 乱码或则中文无法正确查询问题
解决Oracle本身的字符集问题 oracle数据库的字符集更改 A.oracle server 端 字符集查询 select userenv('language') from dual 其中NLS_ ...
- Orchard运用 - 定制呈现最新博客文章
每个博客系统为了吸引更多访问量,一般都会在首页或侧边栏列举一些最新文章/随笔以获取更多点击.其实也就是查询出最新的几篇文章并按照简练的方式呈现,比如一般都只有标题及其对应的链接,有时也会标注一下作者和 ...
- jquery easyui里datagrid用法记录
1.删除行方法(deleteRow) $(); //1代表选中的行索引 2.删除多行数据 var rows = $('#ruleManagementTable').datagrid("get ...
- java学习笔记12--异常处理
java学习笔记系列: java学习笔记11--集合总结 java学习笔记10--泛型总结 java学习笔记9--内部类总结 java学习笔记8--接口总结 java学习笔记7--抽象类与抽象方法 j ...
- 免费的.net云平台appharbor.com
支持Mysql,MSSQL2008R2免费的都是20MB 提供codeplex,GitHub,BitBucket部署到appharbor.com 也可以使用Git来部署应用,但不支持FTP 可以一键安 ...
- FrameWork数据权限浅析1之基于手工修改模型实现行级数据安全
1:环境 Cognos10.2.0,Oracle 2:实现过程 在设置Framework数据级别权限的时候,通常用到的就是在FM的设置数据安全的地方添加安全过滤器,如下图 step1:选中部门维度表→ ...
- QPS、RT、PV、UV之间的关系
QPS: 每秒查询率(Query Per Second) ,每秒的响应请求数,也即是最大吞吐能力. QPS = req/sec = 请求数/秒 QPS统计方式 [一般使用 http_load 进行统计 ...
- 【python】列出http://www.cnblogs.com/xiandedanteng/p/中的标题
# 列出http://www.cnblogs.com/xiandedanteng/p/中的标题 from bs4 import BeautifulSoup import requests user_a ...
- authpuppy 认证服务器搭建
此文仅限于搭建authpuppy认证服务器,不包含认证插件等安装,仅说明步骤以备下次安装忘记步骤.耽误时间. 环境:ubuntu10.04 软件版本:authpuppy-1.0.0-stable.tg ...