.exe 文件 apache 出现 403 错误

发布于 2024-12-20 23:22:30 字数 421 浏览 5 评论 0原文

我有一个在 centos 环境上运行的 apache 网络服务器。有一个文件夹,其中有一个扩展名为 .exe 的文件

,当我尝试使用 http://mysite.com/folder/x.exe 我收到 403 错误。

但如果我将 gif 添加到该文件夹​​,它就可以 http://mysite.com/folder/pic.gif< /a>

我没有 SSH 访问此服务器的权限,但需要知道为什么会发生这种情况,文件权限也正确。

任何帮助表示赞赏

I have an apache webserver running on centos environment. There is a folder and in that there is a file which has an extension .exe lets name the file x.exe

when I try download this file using http://mysite.com/folder/x.exe I get a 403 error.

but if I add a gif to that folder it works http://mysite.com/folder/pic.gif

I dont have SSH access to this server but need to know some clue for why this is happenning, the file permissions are correct too.

any help is appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酒解孤独 2024-12-27 23:22:30

在 Apache 的 httpd.conf 中,可以为某些文件类型或路径指定默认处理操作。您的服务器可能被配置为阻止所有可执行文件。类似的阻塞也可能发生在 .htaccess 文件中。有几种方法可以做到这一点...这是一种:

<Files ~ "\.exe$">
Order allow,deny
Deny from all
</Files>

这个小片段可以位于主 .conf 文件中,并包含 .conf 文件,或者 >.htaccess 文件(或全部三个!),这只是一种可能性。最好的办法是检查服务器日志。他们将以类似于以下的形式指出给定请求被拒绝的原因:

[Wed Oct 11 14:32:52 2000] [错误] [客户端 127.0.0.1] 客户端被拒绝
服务器配置:/www/root

查看此文档以获取有关服务器的信息日志(包括日志本身的默认路径)。

正如我所提到的,还有一些其他方法可以阻止对某些文件类型、某些文件、某些文件夹等的访问。如果不查看错误日志,就很难确定原因。此外,如果没有对服务器的完全访问权限,可能无法改变此行为。这种阻止可能是您的网络主机的政策问题。

Within Apache's httpd.conf, it is possible to specify default handling actions for certain file types or paths. It may be that your server is configured to block executable files all together. Similar blocking can also occur in an .htaccess file. There are a few ways to do it... here's one:

<Files ~ "\.exe$">
Order allow,deny
Deny from all
</Files>

That little snippet could be in the main .conf file, and included .conf file, OR an .htaccess file (or all three!), and again, that is just one possibility. Your best bet is to check out the server logs. They will indicate why a given request was denied in a form similar to this:

[Wed Oct 11 14:32:52 2000] [error] [client 127.0.0.1] client denied by
server configuration: /www/root

Take a look at this document for information about server logs (including default paths to the logs themselves).

As I mentioned, there are a few other ways to block access to certain file types, certain files, certain folders, etc. Without looking at the error logs, it is very difficult to determine the cause. Further, without full access to the server, it may not be possible to alter this behavior. This blockage could be in place as a matter of policy for your web host.

猫九 2024-12-27 23:22:30

我想补充一点,我花了大约 2 个小时一遍又一遍地尝试这个废话,结果发现 selinux 拒绝了 httpd 的特定文件类型。

尝试:

setenforce Permissive

并查看是否可以纠正错误

标签
软呢帽 16

I'd like to add I spent like 2 hours trying this crap over and over again only to discover that selinux was denying specific file types for httpd.

try:

setenforce Permissive

and see if that corrects the error

tag
Fedora 16

歌入人心 2024-12-27 23:22:30

好吧,答案是我把它放在一个文件夹中,它禁止

Deny from all
<FilesMatch "\.(html|HTML|htm|HTM|xhtml|XHTML|js|JS|css|CSS|bmp|BMP|png|PNG|gif|GIF|jpg|JPG|jpeg|JPEG|ico|ICO|pcx|PCX|tif|TIF|tiff|TIFF|au|AU|mid|MID|midi|MIDI|mpa|MPA|mp3|MP3|ogg|OGG|m4a|M4A|ra|RA|wma|WMA|wav|WAV|cda|CDA|avi|AVI|mpg|MPG|mpeg|MPEG|asf|ASF|wmv|WMV|m4v|M4V|mov|MOV|mkv|MKV|mp4|MP4|swf|SWF|flv|FLV|ram|RAM|rm|RM|doc|DOC|docx|DOCX|txt|TXT|rtf|RTF|xls|XLS|xlsx|XLSX|pages|PAGES|ppt|PPT|pptx|PPTX|pps|PPS|csv|CSV|cab|CAB|arj|ARJ|tar|TAR|zip|ZIP|zipx|ZIPX|sit|SIT|sitx|SITX|gz|GZ|tgz|TGZ|bz2|BZ2|ace|ACE|arc|ARC|pkg|PKG|dmg|DMG|hqx|HQX|jar|JAR|xml|XML|pdf|PDF)$">
    Allow from all
</FilesMatch> 

在其中添加 exe 并且工作正常,

还有一个注释,这是在 SilverStripe CMS 支持的站点中,并且在 SilverStripe 的资产文件夹中

well the answer was I had this in a folder where it forbids the exe

Deny from all
<FilesMatch "\.(html|HTML|htm|HTM|xhtml|XHTML|js|JS|css|CSS|bmp|BMP|png|PNG|gif|GIF|jpg|JPG|jpeg|JPEG|ico|ICO|pcx|PCX|tif|TIF|tiff|TIFF|au|AU|mid|MID|midi|MIDI|mpa|MPA|mp3|MP3|ogg|OGG|m4a|M4A|ra|RA|wma|WMA|wav|WAV|cda|CDA|avi|AVI|mpg|MPG|mpeg|MPEG|asf|ASF|wmv|WMV|m4v|M4V|mov|MOV|mkv|MKV|mp4|MP4|swf|SWF|flv|FLV|ram|RAM|rm|RM|doc|DOC|docx|DOCX|txt|TXT|rtf|RTF|xls|XLS|xlsx|XLSX|pages|PAGES|ppt|PPT|pptx|PPTX|pps|PPS|csv|CSV|cab|CAB|arj|ARJ|tar|TAR|zip|ZIP|zipx|ZIPX|sit|SIT|sitx|SITX|gz|GZ|tgz|TGZ|bz2|BZ2|ace|ACE|arc|ARC|pkg|PKG|dmg|DMG|hqx|HQX|jar|JAR|xml|XML|pdf|PDF)$">
    Allow from all
</FilesMatch> 

added exe there and worked fine,

also a note, this was in a SilverStripe CMS powered site, and in the assets folder of SilverStripe

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文