Page 1 of 1

Problems with vHosts

PostPosted: 27. January 2009 16:25
by mtnracer
I just installed xampp for Windows and I am having problems with virtual hosts. I configured the default site (c:/xampp/htdocs) and another site in httpd-vhosts.conf and when I try to access the site root via a browser the xampp splash screen is displayed.

However, when I try to access any specific page within the site it cannot find the page.

The error I get in error.log is:
[Tue Jan 27 10:01:51 2009] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/test.php' not found or unable to stat

I noticed that it tries to pull test.php from the default htdocs directory - not from c:/vHosts as specified in the conf file.

Any help is much appreciated.

Re: Problems with vHosts

PostPosted: 27. January 2009 16:28
by Wiedmann
Any help is much appreciated.

I guess there is something wrong in your config file ;-) But I don't know what you have in this file...

Are you using namebased or ip-based vhosts?

Re: Problems with vHosts

PostPosted: 27. January 2009 16:35
by mtnracer
I am using name based vHosts.

The files I am trying to access are located in c:/vHosts/tsvnet and that is the directory I specified.

When I type "http://tsvnet" in my browser the xampp splash screen comes up. When I type "http://tsvnet/test.php" it fails and the error.log file shows an attempt to access the file from c:/xampp/htdocs.

From what I understand, enabling vHosts is supposed to override the default document root location with the information from httpd-vhosts.conf

Re: Problems with vHosts

PostPosted: 27. January 2009 16:36
by glitzi85
Pleas post the vHost Configuration here COMPLETE. You flushed your Cache after changing the configuration?

glitzi

Re: Problems with vHosts

PostPosted: 27. January 2009 16:46
by mtnracer
I stopped and started the apache service several times now. I have to do it through the Windows Services window as I only get an error when trying to stop or start apache through the Xampp control panel. But that is another issue...


#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

<Directory c:/vHosts>
Order Deny,Allow
Allow from all
</Directory>

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
## ServerAdmin webmaster@dummy-host.example.com
## DocumentRoot /www/docs/dummy-host.example.com
## ServerName dummy-host.example.com
## ServerAlias www.dummy-host.example.com
## ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
## CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

##<VirtualHost *:80>
## ServerAdmin webmaster@dummy-host2.example.com
## DocumentRoot /www/docs/dummy-host2.example.com
## ServerName dummy-host2.example.com
## ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
## CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
##</VirtualHost>

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

<VirtualHost *:80>
DocumentRoot c:/vHosts/tsvnet
ServerName tsvnet
</VirtualHost>

Re: Problems with vHosts

PostPosted: 27. January 2009 16:55
by glitzi85
You must also uncomment NameVirtualHosts, otherwise Namebased vHosts are not enabled:

Code: Select all
NameVirtualHost *:80


glitzi

Re: Problems with vHosts

PostPosted: 27. January 2009 17:01
by mtnracer
That did it. Thank you. Vielen Dank.

BTW: Do you prefer English or German on this Forum? / Bevorzugt ihr deutsch oder englisch auf diesem Forum?

Re: Problems with vHosts

PostPosted: 27. January 2009 17:08
by LooseCannon
Woo! glitz85 got in with a one liner, while I was writing way too much. :)

mtnracer, this is in the English part of the forum. Hello and welcome by the way. 8)

Re: Problems with vHosts

PostPosted: 27. January 2009 17:22
by glitzi85
8)

viewforum.php?f=32 = German
viewforum.php?f=33 = Both acceptable
viewforum.php?f=34 = English

glitzi