Apache serving different directory

apache-2.2httpd.confvirtualhost

I have defined a single vhost configuration (see below) for a domain. All HTML files in the root get served properly. But I can't access any files within a particular sub-directory called 'icons'.

example.com/index.html or example.com/pix.jpg work fine but example.com/icons/somefile.jpg gives a 'File not found error' despite the file actually being there.

Moreover, when I try to access example.com/icons/ , instead of getting an error, a file listing of the apache icon directory is displayed!

example.com should serve from /var/www/example.com/public and
example.com/icons/ should serve from /var/www/example.com/public/icons but instead a directory listing of /var/www/icons is shown.

example.com/test/somefile.html works and serves correctly from /var/www/example.com/public/test

Another funny this is, directory listing is disabled but a listing of the icon directory is still displayed for example.com/icons.

DocumentRoot "/var/www/html"

# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
    Order deny,allow
    Deny from all
    Options None
    AllowOverride None
</Directory>

<VirtualHost *:80>
     ServerAdmin admin@example.com
     ServerName example.com
     ServerAlias www.example.com

     DocumentRoot /var/www/example.com/public

     <Directory /var/www/example.com/public>
     Order allow,deny
     Allow from all
     </Directory>

     WSGIDaemonProcess app display-name=%{GROUP}  processes=2 threads=5 maximum-requests=5
     WSGIProcessGroup app

     WSGIScriptAlias /app /var/www/app/app.wsgi

     <Directory /var/www/app>
     Order allow,deny
     Allow from all
     </Directory>

     ErrorLog /var/www/example.com/logs/error.log
     CustomLog /var/www/example.com/logs/access.log combined
</VirtualHost>

Best Answer

hehe..

search in your apache config directory for /icons. you'll probably find in one of the files something like:

Alias /icons/ "/usr/share/apache2/icons/"

in debian/ubuntu world this is set in /etc/apache2/mods-enabled/alias.conf

files served from that directory are used for icons in directories listings generated by apache. just comment out this line and restart the server.