Forum Moderators: phranque

Message Too Old, No Replies

Newbie: virtualhost default index.html problem

         

jake58

8:19 pm on Dec 8, 2006 (gmt 0)

10+ Year Member



Hi, great site.

I have been trying to work around this problem for days and am about to give up and do something else.

My problem is I have 2 websites w/2 registered domains. I have virtualhosts setup up but no matter what I do it always brings up the apache default index.html.

I have created seperate directories,index files and logs. No matter using :80, *, etc all to no avail. I have even tried deleting the default index.html and renaming it. I have used index.html and example.html in the directories to no avail.

If I restart I get no errors. If I go to my websites via the web I get no errors. Everything works fine except the individual index.htmls.

Biggest problem is in all the hundreds of problems like this on a google search no one has a solution that is posted.

Here is my httpd.conf. Thanks in advance:

Listen 80

ServerRoot "C:/Apache"

DocumentRoot "C:/Apache/htdocs"

ServerAdmin datapros@our_hosting.net

ServerName 216.51.***.136

NameVirtualHost 216.51.***.136

<VirtualHost 216.51.***.136>
ServerName example.com
ServerAdmin datapros@our_hosting.net
DocumentRoot c:/example
DirectoryIndex index.html
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>

<VirtualHost 216.51.***.136>
ServerName example2.com
ServerAdmin datapros@our_hosting.net
DocumentRoot c:/example2
DirectoryIndex index.html
</VirtualHost>

[edited by: jdMorgan at 1:28 am (utc) on Dec. 9, 2006]
[edit reason] No URLs or IPs, please. See TOS. [/edit]

jdMorgan

8:39 pm on Dec 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

Your directives and containers appear to be misconfigured. See the example given in the Apache Name-Based Virtual Hosts documentation [httpd.apache.org].

Jim

jake58

10:45 pm on Dec 8, 2006 (gmt 0)

10+ Year Member



I forgot to say I am running apache 2.2 under win2000. From what I have read you are supposed to be able to put in a drive. But anyway I have redone it and get no errors.

I tried exactly like the manual that was written for linux/unix.
Same thing.

I tried it with just example under apache and under apache/htdocs. same thing.

Same problem persists.

Listen 80

ServerRoot "C:/Apache"

DocumentRoot "C:/Apache/htdocs"

ServerAdmin datapros@our_hosting.net

ServerName 216.51.***.136

NameVirtualHost 216.51.***.136

<VirtualHost 216.51.***.136>
ServerName example.com
ServerAdmin datapros@our_hosting.net
DocumentRoot /example
DirectoryIndex index.html
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>

<VirtualHost 216.51.***.136>
ServerName example2.com
ServerAdmin datapros@our_hosting.net
DocumentRoot /example2
DirectoryIndex index.html
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>

[edited by: jdMorgan at 1:23 am (utc) on Dec. 9, 2006]
[edit reason] No URLs, IPs. See Terms of Service. [/edit]

jake58

10:48 pm on Dec 8, 2006 (gmt 0)

10+ Year Member



Also, if I rename or delete the apache/htdocs/index.html I get not have permission to access page. I have entire drive c: shared for testing.

jake58

5:48 am on Dec 9, 2006 (gmt 0)

10+ Year Member



My domains are registered through godaddy and I have altered my 200 hosts file. Is there anything else that needs to be done to the 200 OS?

It just seems apache for some reason is not picking up the domain names and defaulting.

jake58

9:35 am on Dec 9, 2006 (gmt 0)

10+ Year Member



I have found the solution! There are literally hundreds of people that have been looking for this solution on the internet and have not posted a solution for the rest of us that run into this problem.

For some reason contrary to the manual my setup only works with an * instead of my ip address.

If you change to an * with out a directory directive you get a permissions error. By making a directory directive "correctly" it will pass you to your correct index.html.

In this example I have not tweaked it yet for security, so beware!

Listen 80

ServerRoot "C:/Apache"

DocumentRoot "C:/Apache/htdocs"

ServerAdmin datapros@our-hosting.net

ServerName 216.51.***.136

NameVirtualHost *

<VirtualHost *>
ServerName www.example.com
ServerAdmin datapros@our-hosting.net
DocumentRoot /example
DirectoryIndex index.html
ErrorLog /example/logs/error_log
CustomLog /example/logs/access_log common
</VirtualHost>

<VirtualHost *>
ServerName www.example2.com
ServerAdmin datapros@our-hosting.net
DocumentRoot /example2
DirectoryIndex index.html
ErrorLog /example2/logs/error_log
CustomLog /example2/logs/access_log common
</VirtualHost>

# notice example does not have a "/" in front of it!
<Directory example>
Options FollowSymLinks
AllowOverride All
#None
Order allow,deny
#deny,allow
# Deny from all
Satisfy all
</Directory>

# notice example2 does not have a "/" in front of it!
<Directory example2>
Options FollowSymLinks
AllowOverride All
#None
Order allow,deny
#deny,allow
# Deny from all
Satisfy all
</Directory>

[edited by: jdMorgan at 4:09 pm (utc) on Dec. 9, 2006]
[edit reason] Obscured URLs, IPs & e-mail per TOS. [/edit]