Apache Error: Permission denied for /images/

I was trying to test a project I'm working on using my local Apache web server. Everything worked fine, except that it wouldn't load any of the images. I dealt with it for awhile, until I couldn't take it anymore. Why the hell weren't the images showing up?

I tried accessing http://localhost/images/ where they are stored and it said permission was denied. So I tried accessing another directory under the root, in this case /notices/, and everything worked fine. I was able to list the contents of the directory and access the files inside. OK, so I should be able to simply change the permissions on the /images/ directory so they match /notices/. But wait... they already match!

[code]
drwxr-xr-x 3 raam raam 4096 Sep 7 13:31 images
drwxr-xr-x 3 raam raam 4096 Sep 7 13:31 notices
[/code]

OK, so maybe the permissions of the files themselves are wrong? Nope, those match too. I dealt with a problem similar to this awhile back and I resolved it by asking for help in on EFNet. So I decided to head over the once again and ask for help. When I entered the channel, the topic of the room was set to "Read your error log and use your own domain". So before I asked anything, I decided to check my error log. Sure enough, here's what I found in /var/log/apache/error.log:

[code]
raam@mars:/var/www$ tail /var/log/apache/error.log
[Tue Oct 17 14:30:42 2006] [error] [client 127.0.0.1] File does not exist: /usr/share/images/logout.png
[Tue Oct 17 14:30:42 2006] [error] [client 127.0.0.1] File does not exist: /usr/share/images/aerchannel.png
[Tue Oct 17 14:30:46 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[Tue Oct 17 14:30:48 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[Tue Oct 17 14:32:48 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[Tue Oct 17 14:32:56 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[Tue Oct 17 14:33:31 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[Tue Oct 17 14:40:42 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[Tue Oct 17 14:41:44 2006] [error] [client 127.0.0.1] File does not exist: /usr/share/images/logo.jpg
[Tue Oct 17 14:41:52 2006] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/share/images/
[/code]

Ah hah! "Directory index forbidden by rule: /usr/share/images/" Thats odd, there's rule preventing it? So I looked over my httpd.conf AGAIN. After a quick search of "images", I found this:

[code]

Alias /icons/ /usr/share/apache/icons/


Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all

Alias /images/ /usr/share/images/


Options MultiViews
AllowOverride None
Order allow,deny
Allow from all


[/code]

Alias /images/ /usr/share/images/!? What the hell? How inconvenient is that? You would think that the Apache developers would assume that people will have a directory called /images/ in the root of their web path. It is after all a very common directory used to store images for the website. As soon as I removed the alias definition for images and restarted apache, everything worked perfectly. I was able to access /images/ and all the pictures showed up on my site.

Write a Comment

Comment