VPS侦探论坛

 找回密码
 注册
查看: 6941|回复: 2

如何禁止访问某些文件?

[复制链接]
发表于 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 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-7-17 11:05:14 | 显示全部楼层


写的没错,但是为什么不生效呢
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2011-7-18 17:15:18 | 显示全部楼层

重装了下,规则又生效了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-20 23:37 , Processed in 0.025598 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表