LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache 2.2 Virtual Hosts won't serve index.html (https://www.linuxquestions.org/questions/linux-server-73/apache-2-2-virtual-hosts-wont-serve-index-html-808229/)

lspiehler 05-16-2010 09:25 PM

Apache 2.2 Virtual Hosts won't serve index.html
 
I've hosted my own apache2.2 server on debian lenny for a while now, and the other day, I went to set up a new virtual host with an index.html file in the document root. I had to actually type index.html in the end of the url for the page to display. Otherwise I get a 404 "Not Found" "The requested URL / was not found on this server." All of my other virtual hosts work fine. I then realized that all other pages were index.php, so I checked the DirectoryIndex directive, and index.html is at the front of the list. I did try to move it down the list out of desperation, but it didn't help. I then changed my index.html to index.php, and sure enough, it came up correctly. Index.htm is also in the DirectoryIndex directive, but changing it to that didn't work either. The php thing does seem to work fine, but I'd really like to figure out whats going on. Also, in my test setup, with a .htm and .html file (I have attempted with only one or the other) when trying to access the site, my error log shows "Attempt to serve directory: /var/www/test/" for every attempt. Any help is greatly appreciated.

sushantchawla2005 05-16-2010 11:48 PM

Quote:

Originally Posted by lspiehler (Post 3970937)
I've hosted my own apache2.2 server on debian lenny for a while now, and the other day, I went to set up a new virtual host with an index.html file in the document root. I had to actually type index.html in the end of the url for the page to display. Otherwise I get a 404 "Not Found" "The requested URL / was not found on this server." All of my other virtual hosts work fine. I then realized that all other pages were index.php, so I checked the DirectoryIndex directive, and index.html is at the front of the list. I did try to move it down the list out of desperation, but it didn't help. I then changed my index.html to index.php, and sure enough, it came up correctly. Index.htm is also in the DirectoryIndex directive, but changing it to that didn't work either. The php thing does seem to work fine, but I'd really like to figure out whats going on. Also, in my test setup, with a .htm and .html file (I have attempted with only one or the other) when trying to access the site, my error log shows "Attempt to serve directory: /var/www/test/" for every attempt. Any help is greatly appreciated.


In your virtual host section try putting DirectoryIndex index.html
I was facing the same problem & it got resolved with this extra directive in my virtual host container.

Regds
Sushant Chawla
Linux Administrator

lspiehler 05-17-2010 05:27 PM

Thank you for your reply. I had tried that previously, but I tried it again hoping I'd made a mistake before. Unfortunately its a no-go. Any other ideas?

sushantchawla2005 05-17-2010 11:30 PM

Quote:

Originally Posted by lspiehler (Post 3971989)
Thank you for your reply. I had tried that previously, but I tried it again hoping I'd made a mistake before. Unfortunately its a no-go. Any other ideas?

Can you send me the configurations of your apache file?

Regds
Sushant Chawla
Linux Administrator

tniemela 08-11-2011 04:27 AM

I encountered today the same problem using Apache 2.2.18.

Do you have any other virtual host defined under the same document root? I mean if your configuration is this way:

VHOST A uses: DocumentRoot /home/test/public_html
VHOST B uses: DocumentRoot /home/test/public_html/test

It causes that error. It's getting even more interesting, my another shell that uses 2.2.17, does not have this error. After configuring VHOST B to it's own documentroot, it solved this issue for 2.2.18


All times are GMT -5. The time now is 06:36 AM.