uKolka uKolka - 2 months ago 6
Apache Configuration Question

Apache doesn't serve files in "javascript" directory. Why?

All of the sudden I started getting 404s for files like

http://example.localhost/javascript/jquery.min.js


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

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.

Answer

I was trying to find solution to this on SO, but couldn't. So I'm just leaving this here if anyone happens to encounter the same problem.

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 config file name I found some explanation.

I don't know why, but I had 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.