Reputation: 38680
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.
Upvotes: 26
Views: 32695
Reputation: 3
Uninstall apache2
and delete these folders:
Then reinstall javascript-common
and apache2
.
Upvotes: -4
Reputation: 251
I just had a similar problem on an Ubuntu system. Apparently the javascript-common
package was hosed at some point in time and the configure script wouldn't run properly. Removing javascript-common
and reinstalling with apt-get would not fix it. I had to:
dpkg --purge javascript-common
apt-get install javascript-common
And that seemed to fix the problem. This is an Ubuntu 16.04 LTS (Xenial Xerus) system that was upgraded from Ubuntu 14.04 LTS (Trusty Tahr).
Upvotes: 1
Reputation: 83
I'm on a Debian machine, and there is no a2disconf command. I found the /etc/apache2/conf.d
directory is a link to /etc/javascript-common/javascript-common.conf
.
I went and edited that file (as root) and changed it to alias /javascript-common
instead of /javascript
by changing the top line to
Alias /javascript-common /usr/share/javascript/
and saving it and restarting Apache.
Upvotes: 1
Reputation: 17471
Web applications that use JavaScript need to distribute it through HTTP. Using a common path for every script avoids the need to enable this 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.
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.
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-common
a2enconf javascript-common
Upvotes: 11
Reputation: 38680
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.
Upvotes: 37
Reputation: 22952
You don't need to edit the conf file or purge the package just disable it.
a2disconf javascript-common
service apache2 reload
If for some reason you want to use that conf:
a2enconf javascript-common
service apache2 reload
Upvotes: 15