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

<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

     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

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


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.

  • For all XAMPP users: I've found an icons alias line in apache/conf/extra/httpd-autoindex.conf. If you don't find it, it'll be the best to search in the whole conf directory (e.g. using Notepad++). – ComFreek May 22 '13 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.