location 禁止以/data开头的文件

[root@web01 default]# tree data/
data/
└── index.html directories, file
[root@web01 default]# cat data/index.html
this is data!!!!
[root@web01 default]# curl http://192.168.1.24/data/
this is data!!!!
[root@web01 default]# 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;}
location ~ ^/data {deny all;}
[root@web01 default]# /app/server/nginx/sbin/nginx -s reload
[root@web01 default]# curl http://192.168.1.24/data/
<html>
<head><title> Forbidden</title></head>
<body bgcolor="white">
<center><h1> Forbidden</h1></center>
<hr><center>nginx/1.4.</center>
</body>
</html>
上一篇:计算PI -- 采用随机模拟方法


下一篇:Mybatis异常_01_Invalid bound statement (not found)