Apache 提供不应提供服务的文件
今天,我发现我全新安装的 Apache HTTP Server 能够提供 C:\uploads\
目录 中的文件。
我在 C:\uploads
中有两个文件夹:
- C:\uploads\templates
- C:\uploads\sites
这两个文件夹都包含 testimage.jpg
。
Apache 将从模板文件夹中提供文件。
我发现,如果我请求: http://localhost/templates/testimage, jpg
但是, http://localhost/sites/testimage.jpg 404的!
天哪 - 首先,为什么 Apache 首先提供 templates 文件夹? 很特别吗?
其次,apache 根据什么任意规则禁止访问其他文件夹(例如站点)?
我很困惑。 也许我在安装过程中某个地方转错了方向。
Today I discovered that my fresh installation of Apache HTTP Server is able to serve files from my C:\uploads\
directory.
I have two folders in C:\uploads
:
- C:\uploads\templates
- C:\uploads\sites
Both folders contain testimage.jpg
.
I found that Apache will serve the files from the templates folder if I request:
http://localhost/templates/testimage.jpg
However, http://localhost/sites/testimage.jpg 404's!
OMG - firstly, why does Apache serve the templates folder in the first place? Is it special?
Secondly, by what arbitrary set of rules does apache disallow access to other folders such the sites?
I'm so confused. Perhaps I've taken a wrong turn somewhere during the installation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否查看过 httpd.conf 文件以了解所提供服务的规则是什么? 或者,是否有 .htaccess 文件可能会更改所提供的服务? 您可能在其中一个中公开了模板,但在网站中没有公开......这是您首先想到的事情。
我建议仔细检查这些配置文件,看看是什么导致了您所看到的行为。
Did you look through your httpd.conf file to see what rules are in place for what is being served? Alternatively, are there .htaccess files that may be changing what is being served? You might have templates exposed in one or the other, but not sites... that's the first thing that comes to mind.
I would suggest going through these configuration files with a fine toothed comb to see what may cause the behavior you see.