security - Apache - 如何拒绝目录但允许该目录中的一个文件

标签 security apache webserver

我尝试将 Apache .conf 文件配置为拒绝列出某个类别,但我想允许此类别中的特定文件。 目录规则似乎比文件规则“更强”,因此当同时使用两者时 - 我无法访问该特定文件。

这是我尝试的:

<Directory /var/www/denied_directory>
     order deny,allow
     Deny From All
</Directory>

<Files safefile.php>
    Order Allow,Deny
    Allow from All
</Files>

最佳答案

如果配置正确,它可以完美运行:

   <Directory /var/www/denied_directory>
        Order allow,deny
        <Files test.php>
           Order deny,allow
        </Files>
   </Directory>

关于security - Apache - 如何拒绝目录但允许该目录中的一个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6243677/

相关文章:

windows - 登录 Windows 用户的 API

security - WebRTC 的 SDP 是否应该为安全通信私有(private)?

security - 在我的 AWS EC2 实例上设置负载均衡器

java - 通过 J_security_check

java - 网络爬虫向服务器连续请求之间的最小延迟

c++ - 接收 HTTP header

android - 在 android ics 中禁用屏幕截图

apache - mod_rewrite 规则以防止查询字符串

apache - SVN Repo 给出 404 not Found

perl - 如何使用 Perl 提供 Kerberos 协商身份验证 HTTP 服务器端