Page 1 of 1

VHOST Help Please

PostPosted: 30. January 2009 23:25
by Billy21
Hello all,

I have an issue with my vhost file and was hoping that someone could help me trouble shoot it as I am a complete n00bie.

Code: Select all
# Virtual Hosts

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot c:/webhost/htdocs
ServerName localhost
</VirtualHost>


<VirtualHost siteone:80>
NameVirtualhost www.siteone.com
ServerName www.siteone.com
ServerAlias *.www.siteone.com
ServerSignature Email
ServerAdmin c.g.admin@someemailaddress
ServerPath c:/webhost/htdocs/siteone
DocumentRoot c:/webhost/htdocs/siteone
</VirtualHost>

<VirtualHost www.sitetwo.net:80>
NameVirtualhost www.sitetwo.net
ServerName www.sitetwo.net
ServerAlias *www.sitetwo.net
ServerSignature Email
ServerAdmin c.g.admin@someemailaddress
ServerPath c:/webhost/htdocs/sitetwo
DocumentRoot c:/webhost/htdocs/sitetwo
</VirtualHost>

<VirtualHost www.sitethree.com:80>
NameVirtualhost www.sitethree.com
ServerName www.sitethree.com
ServerAlias *www.sitethree.com
ServerSignature Email
ServerAdmin c.g.admin@someemailaddress
ServerPath c:/webhost/htdocs/sitethree
DocumentRoot c:/webhost/htdocs/sitethree
</VirtualHost>

<VirtualHost www.sitefour.com:80>
NameVirtualhost www.sitefour.com
ServerName www.sitefour.com
ServerAlias *.www.sitefour.com
ServerSignature Email
ServerAdmin c.g.admin@someemailaddress
ServerPath c:/webhost/htdocs/sitefour
DocumentRoot c:/webhost/htdocs/
</VirtualHost>



Code: Select all
C:\webhost\apache\bin>apache -S
Warning: DocumentRoot [C:/webhost/xampp/htdocs] does not exist
[Fri Jan 30 13:46:54 2009] [warn] NameVirtualHost www.sitetwo.net:80 has no VirtualHosts
[Fri Jan 30 13:46:54 2009] [warn] NameVirtualHost www.sitethree.com:80 has no VirtualHosts
[Fri Jan 30 13:46:54 2009] [warn] NameVirtualHost www.sitefour.com:80 has no VirtualHosts
VirtualHost configuration:
000.000.000.000:80       is a NameVirtualHost
         default server www.siteone.com (C:/webhost/apache/conf/extra/httpd-vhosts.conf:62)
         port 80 namevhost www.siteone.com (C:/webhost/apache/conf/extra/httpd-vhosts.conf:62)
         port 80 namevhost www.sitetwo.net (C:/webhost/apache/conf/extra/httpd-vhosts.conf:72)
         port 80 namevhost www.sitethree.com (C:/webhost/apache/conf/extra/httpd-vhosts.conf:82)
         port 80 namevhost www.sitefour.com (C:/webhost/apache/conf/extra/httpd-vhosts.conf:92)
wildcard NameVirtualHosts and _default_ servers:
_default_:443          localhost (C:/webhost/apache/conf/extra/httpd-ssl.conf:74)
*:80                   is a NameVirtualHost
         default server localhost (C:/webhost/apache/conf/extra/httpd-vhosts.conf:21)
         port 80 namevhost localhost (C:/webhost/apache/conf/extra/httpd-vhosts.conf:21)
Syntax OK


Any help is appreciated

Thanks Billy

Re: VHOST Help Please

PostPosted: 31. January 2009 01:31
by Izzy
I am assuming that you used a tutorial or book perhaps to arrive at your vhosts configurations?


First you need to correct this:
Warning: DocumentRoot [C:/webhost/xampp/htdocs] does not exist

I have substituted what would be a normal DocumentRoot for a default XAMPP installation.
Check the path to your htdocs folder in XAMPP and edit the DocumentRoot to reflect your findings.

Try this and there are many more successful examples and tips from a forum search for virtualhost or vhosts in the forum XAMPP for Windows which would have helped you in the first place.
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
ServerName siteone.com
ServerAlias *.siteone.com
ServerSignature EMail
ServerAdmin c.g.admin@someemailaddress
DocumentRoot "C:/xampp/htdocs/siteone"
</VirtualHost>

<VirtualHost *:80>
ServerName sitetwo.net
ServerAlias *.sitetwo.net
ServerSignature EMail
ServerAdmin c.g.admin@someemailaddress
DocumentRoot "C:/xampp/htdocs/sitetwo"
</VirtualHost>

<VirtualHost *:80>
ServerName sitethree.com
ServerAlias *.sitethree.com
ServerSignature EMail
ServerAdmin c.g.admin@someemailaddress
DocumentRoot "C:/xampp/htdocs/sitethree"
</VirtualHost>

<VirtualHost *:80>
ServerName sitefour.com
ServerAlias *.sitefour.com
ServerSignature EMail
ServerAdmin c.g.admin@someemailaddress
DocumentRoot "C:/xampp/htdocs/sitefour"
</VirtualHost>


Add these to C:\Windows\system32\drivers\etc\HOSTS file - drag into your text editor:
Code: Select all
127.0.0.1 siteone.com
127.0.0.1 sitetwo.com
127.0.0.1 sitethree.com
127.0.0.1 sitefour.com

For siteone.com these URI should find the web sites if they exist in the C:\xampp\htdocs\siteone folder:
http://siteone.com
http://www.siteone.com
http://anythinghere.siteone.com

ServerPath is a legacy directive not used much these days with our modern browsers being what they are and so no need to include this bearded ancient fellow.
Apache Docs wrote:ServerPath Directive
Description: Legacy URL pathname for a name-based virtual host that is accessed by an incompatible browser
Syntax:ServerPath URL-path

http://httpd.apache.org/docs/2.2/mod/directives.html

Re: VHOST Help Please

PostPosted: 01. February 2009 01:08
by Billy21
Hey Izzy,

First off, thank you for taking the time to answer my question.

I am assuming that you used a tutorial or book perhaps to arrive at your vhosts configurations?


Sorta of, I kind of inherited the Webhost from someone else and only had their work to look off of. This is all new to me and I could only go by what they had done before me. So your help is greatly appreciated.

I would love a "how to" on all of this stuff and if you could point me in the right direction that would be awesome. I do know about the search function here on the forums and will do my best to filter through the posts to find my answers before I post a question.

Billy

Re: VHOST Help Please

PostPosted: 01. February 2009 01:32
by Izzy
A forum search in the XAMPP for Windows forum is a good place to start as is Google and of course the Apache docs.

Have you tried the above vhost code by copying and pasting into your httpd-vhosts.conf file and then making any edits required to see if it works for you?

Backup your original httpd-vhost.conf file first and remember to restart Apache after editing any conf or ini file.

Re: VHOST Help Please

PostPosted: 01. February 2009 05:45
by Billy21
Hey Izzy,

Yes, I edited my file using your edits and everything is working perfect.

Once again thank you for your time.

Billy

Re: VHOST Help Please

PostPosted: 01. February 2009 05:52
by Izzy
Your welcome Billy and thanks for posting back as it helps others who search with similar issues to find a solution that knowingly works and of course puts closure on the topic.

Good luck and best wishes.