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.
推荐答案
我试图在 StackOverflow 上找到解决方案,但我找不到.所以如果有人碰巧遇到同样的问题,我就把这个留在这里.
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屋!