hvbirder 发表于 2011-7-15 16:11:18

如何禁止访问某些文件?

之前在mapn下验证有效的规则,到lnmp里都无效了,htaccess和xml文件始终是可以访问到的
比如:
location ~ /errors/.*\.(xml|phtml)?$ { deny all; }
或者 location /errors/.*\.(xml|phtml)?$ { deny all; }
还有
location ~ .*\.(ftpquota|htaccess|htpasswd|asp|aspx|jsp|asa|mdb)?$ {
                deny all;
                }
我把自带的规则修改下,也无效
                location ~ .*\.(js|css)?$
                        {
                              expires      12h;
                        }
换个扩展名,改成
                location ~ .*\.(htaccess|xml)?$
                        {
                              deny all;
                        }

不解
把deny all; 换成 return 403; 还是可以访问.htaccess和xml文件

[ 本帖最后由 hvbirder 于 2011-7-15 16:13 编辑 ]

monface 发表于 2011-7-17 11:05:14

写的没错,但是为什么不生效呢

hvbirder 发表于 2011-7-18 17:15:18

重装了下,规则又生效了
页: [1]
查看完整版本: 如何禁止访问某些文件?