2

Running apache on Fedora.

My virtual host config looks like :

NameVirtualHost 184.106.108.173:80

<VirtualHost 184.106.108.173:80>
  ServerName www.sandboxmadness.com
  DocumentRoot /var/www/admin/public
    <Directory "/var/www/admin/public">
      Options Indexes FollowSymLinks
      AllowOverride All   
      Order allow,deny
      Allow from all
  </Directory>
</VirtualHost>
<VirtualHost 184.106.108.173:80>
  ServerAlias www.meatball-parm.us
  DocumentRoot /var/www/meatball
  ServerName www.meatball-parm.us
  DirectoryIndex index.html
</VirtualHost>

The first vhost works like a champ. When I resolve the meatball address, the browser opens the right folder, but displays a directory listing, instead of opening the index file.

4
  • Hate to ask the obvious question but. . . have you restarted Apache?
    – Rilindo
    Oct 12, 2011 at 15:47
  • yessir, definitely restarted apache. . .
    – TuK
    Oct 12, 2011 at 15:49
  • 1
    You may want to try clearing yourbrowser cache. When I try www.meatball-parm.us I get connected and redirected to a worldpress install/blog.
    – user9517
    Oct 12, 2011 at 18:00
  • 1
    Fixed it. . . it turned out to be a depreciated DirectoryIndex directive hidden away in the main conf file. Looks like a virtual host directive will not override a directive specified in the main conf. Stackexchange wont let me answer my question for another 4 hours. (Not enough rep) Thanks for all the help though ;)
    – TuK
    Oct 12, 2011 at 18:27

4 Answers 4

4

Found it. . . there was another DirectoryIndex directive buried in the conf file, that was set to index.php. Apparently a directive specified in a virtual host does not overwrite directives specified in the 'main configuration'.

1
  • 1
    Could you explain how you found it? Dec 24, 2017 at 18:59
1

Could you check your logs ? You will maybe see an error (file not openable, directory not readable...). If you type the URL with the end with index.html, is it working ? Your index is not PHP or something else ?

1

In my case, the mod_dir.so file was commented out in:

LoadModule ... mod_dir.so

Uncommented it, restarted apache and everything started working!

0

Today we found a very strange behaviour on our SLES 11 SP4 Server with Apache 2.2.

Apache completly "ignored" the DirectoryIndex index.html in our vhosts.conf , when the htdocs files where NOT owned by the Apaches service-account (wwwrun.www in our case), even though file permissions where sufficient through OTHERS (R+X). We where able to access the index.html without problems if we address it explicitly on the url, but failed when not mentioned on the URL.

but the very moment we recursively changed the htdocs ownership back to the SLES defaults (wwwrun.www) apache started to work normal and the DirectoryIndex given file was served again, without mentioning it explicitly on the URL .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .