Apache doesn't serve files in "javascript" directory. Why?
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.
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.
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.
The issue:
Web applications that use JavaScript need to distribute it throughHTTP. Using a common path for every script avoids the need to enablethis path in the HTTP server for every package.
This is the package that creates /usr/share/javascript
alias and enables it in the Apache webserver.
Recommended fix
And that's it. You won't have any other problem with javascript directories. Another fix could be to rename /usr/share/javascript/
to /usr/share/javascript-common/
, then adjust the Alias in javascript-common.conf
to point to the renamed directory. I am still not sure if this will affect any future update.
Another Fix:
Go to /etc/apache2/conf-available/javascript-common.conf
. You will find this:
Alias /javascript /usr/share/javascript/<Directory "/usr/share/javascript/"> Options FollowSymLinks MultiViews</Directory>
So you just have to comment these lines (with the #
char) (it is not recommended to edit the file directly in conf-enabled) to avoid the forbidden error. After that, do this:
a2disconf javascript-commona2enconf javascript-common