问题原文
原帖链接 · Johann Oskarsson · CC BY-SA 4.0
I am runninng Apache 2.4 on Windows 10. To deny access to DLL files in a specific directory, I try
<Directory "${SRVROOT}/htdocs">
#...
<Files "*.dll">
Require all denied
</Files>
#...
</Directory>
Without this, and given a nonexistant file, such as foo.dll it gives 404. With the configuration, the same nonexistant foo.dll gives 403, so I know the configuration is valid; however, when I try to access bar.dll which exists in the given directory, I'm asked to download it. Why is that?
How do I figure out what might be overwriting my <Files ...> directive?
已采纳解答
原帖链接 · Johann Oskarsson · CC BY-SA 4.0
Ok, to achieve what I wanted, I revoked all access in the general case, and explicitly allowed individual files, like this.
<Directory "${SRVROOT}/htdocs">
#...
Require all denied
<Files "*.exe">
Options +ExecCGI
SetHandler fcgid-script
Require all granted
</Files>
</Directory>
That properly prevents loading of .dll files and everything else extraneous in the directory.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
