Apache 不在“javascript"中提供文件.目录.为什么? [英] Apache doesn't serve files in "javascript" directory. Why?
问题描述
突然间,我开始为 http://example.localhost/javascript/jquery.min.js
之前一切正常.我没有更改任何配置,至少没有手动更改.
Earlier everything was working just fine. I didn't change any configs, at least not manually.
但是现在如果我尝试访问 /javascript
目录本身,我会得到 "Cannot serve directory/usr/share/javascript/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) 找到,并且在 Apache 错误日志中被 Options 指令禁止的服务器生成的目录索引
.
But now if I'd try to access the /javascript
directory itself I would get "Cannot serve directory /usr/share/javascript/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
in the Apache error log.
推荐答案
我试图在 Stack Overflow 上找到解决方案,但我做不到.所以如果有人碰巧遇到同样的问题,我就把它留在这里.
I was trying to find solution to this on Stack Overflow, but I couldn't. So I'm just leaving this here if anyone happens to encounter the same problem.
那么为什么它会在/usr/share/javascript 中查看,而不是我在 VirtualHost 中配置的内容.为了弄清楚这一点,我做了以下事情:
So why the hell would it look in the /usr/share/javascript instead of what I had configured in the VirtualHost. To figure that out I did something like the following:
$ cd /etc/apache2
$ grep -R Alias * | grep share
...
conf-enabled/javascript-common.conf:Alias /javascript /usr/share/javascript/
...
在谷歌搜索该配置文件名后,我发现 一些解释.
After googling for that configuration file name I found some explanation.
我不知道为什么,但我安装了 javascript-common 包.摆脱它似乎没有害处,所以 $ sudo apt-get purge javascript-common
为我解决了这个问题.
I don't know why, but I had the javascript-common package installed.
It doesn't seem harmful to get rid of it, so doing $ sudo apt-get purge javascript-common
solved the problem for me.
这篇关于Apache 不在“javascript"中提供文件.目录.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!