Apache不在"javascript"服务中提供文件.目录.为什么? [英] Apache doesn't serve files in "javascript" directory. Why?

查看:51
本文介绍了Apache不在"javascript"服务中提供文件.目录.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然之间,我开始为http://example.localhost/javascript/jquery.min.js

之前,一切正常.我没有更改任何配置,至少没有手动更改.

Earlier everything was working just fine. I didn't change any configs, at least not manually.

但是现在,如果我尝试访问/javascript目录本身,我会在Apache错误日志中得到"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.

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.

推荐答案

我试图在StackOvern上找到解决方案,但我找不到.因此,如果有人碰巧遇到相同的问题,我就把它留在这里.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆