Virtual hosts in Win 7 - beginner config issue [SOLVED]

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Virtual hosts in Win 7 - beginner config issue [SOLVED]

Postby pmonett » 15. June 2011 09:42

Hello everyone,

First time with XAMPP and I need to create virtual hosts in Win7.

XAMPP is running fine, albeit with a little line on startup :

ERROR: Status Check Failure [-2]

This error does not keep me from running the Control Panel, nor does it prevent Apache from serving pages.

My hosts file includes a line 127.0.0.1 myserver

My httpd.conf file redirects the root folder with <Directory "D:/localhost">

My httpd-vhosts.conf contains the following :

NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "D:/localhost"
ServerName localhost

<Directory "D:/localhost">
AllowOverride None
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/localhost/myserver
ServerName myserver

<Directory "D:/localhost/myserver">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


As far as I can tell, this is in line with how things should be configured for a proper virtual host setup. Unfortunately, it cannot be true because, if I uncomment the line

Include "conf/extra/httpd-vhosts.conf"

in the httpd.conf file, then start up Apache, both localhost and myserver send me to the same page - the one for localhost.

So there must be an issue in my vhost configuration, but I am at a loss as to what.
oh, and I have tried

<VirtualHost localhost:80>
ServerAdmin webmaster@localhost
DocumentRoot "D:/localhost"
ServerName localhost

<Directory "D:/localhost">
AllowOverride None
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

<VirtualHost myserver:80>
ServerAdmin webmaster@localhost
DocumentRoot D:/localhost/myserver
ServerName myserver

<Directory "D:/localhost/myserver">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

but there is still no change.

Thank you for your help
Last edited by pmonett on 15. June 2011 10:58, edited 2 times in total.
pmonett
 
Posts: 5
Joined: 15. June 2011 09:19

Re: Virtual hosts in Win 7 - beginner config issue

Postby Sharley » 16. June 2011 02:18

pmonett wrote:XAMPP is running fine, albeit with a little line on startup :

ERROR: Status Check Failure [-2]
Download, extract xampp_control3.exe to your \xampp\ folder then use this new version of the XAMPP Control Panel - much better and should eliminate this annoyance:
http://arloh.de/xampp/xampp_control3.0.2.zip
Topic here:
viewtopic.php?f=16&t=46743

pmonett wrote:My hosts file includes a line 127.0.0.1 myserver
Does it also include as the first uncommented entry the line for localhost and look like this?
Code: Select all
127.0.0.1 localhost
127.0.0.1 myserver


pmonett wrote:My httpd.conf file redirects the root folder with <Directory "D:/localhost">
Why did you need to do this?
The httpd-vhosts.conf file overrides any entries in the httpd.conf file as it is read after it.
The httpd.conf file should remain in it's default state and any user edits can then be carried out in the configuration files found in the extra folder - always make a backup copy first.

What exactly have you changed in the httpd.conf file?

Also which version of XAMPP did you install?

Where did you install XAMPP on your PC?

Please use the forum code and or quote tags to enter relevant configuration settings - thanks.

Your vhost perhaps needs this corrected
Code: Select all
DocumentRoot D:/localhost/myserver
TO
DocumentRoot "D:/localhost/myserver"
But some of the questions I asked may also be affecting your ability to move forward.



pmonett wrote:As far as I can tell, this is in line with how things should be configured for a proper virtual host setup. Unfortunately, it cannot be true because,
At least you are aware that there are issues with your Apache configurations.

pmonett wrote:...if I uncomment the line

Include "conf/extra/httpd-vhosts.conf"
This line is uncommented by default and should remain so.
Seems you like changing things in the conf files without knowing too much about the consequences but if you read the documentation at the apache web site then most things become much clearer and much quicker than the trial and error approach - making a backup copy of any configuration file before attempting changes is best practice, so you can always revert to a know working position.

pmonett wrote:then start up Apache, both localhost and myserver send me to the same page - the one for localhost.
This is an indication that there is something wrong with your configuration as vhost will default to the first known good entry and use it as the default vhost.

To test your vhost configuration as seen by the Apache server then by using the new XAMPP Control Panel click on the XAMPP Shell button and type
Code: Select all
httpd -S
at the # prompt and it should provide some feedback that you could paste here by using the Edit feature of the console window (right click on the top left window icon reveals a menu) - Apache and most things in XAMPP are case sensitive.

pmonett wrote:oh, and I have tried
Have you tried a forum search in the English XAMPP for Windows forum for vhost or virtualhost as there are many posts with some very useful examples to also try out - accuracy in entering the configuration directives is very important and if not accurate can lead to some very frustrating outcomes.

Let me know back the details I asked for and I will then attempt to provide you with a workable solution.
My last successful post on vhost configuration was here:
viewtopic.php?f=16&t=47280
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Virtual hosts in Win 7 - beginner config issue

Postby pmonett » 16. June 2011 07:02

It's working.

Thank you for your reply. I went and copied your vhost configuration data and just modified server names and directory location, and now it works fine.

That obviously means that there was something I didn't type right, so now I'll hunt it down.

As for your questions, I think most of them can be answered thusly : I am running Windows 7 and, on the install page of XAMPP, it is councelled to use a data directory outside of the Program Files tree to avoid access issues. That is why I changed the httpd.conf file. I did a few tests with Apache on that, then moved on to configuring the vhosts file. I met with several failures on that point, which led me to commenting out the vhosts inclusion line in the httpd file to ensure that I still had a proper Apache installation. Thus, when I'm ready to try with virtual hosts again, I remove the comment from the line in the httpd file.

Now I'm going to compare your syntaxe with mine, find out what went wrong, then move on to adding another IP configuration.

Thank you for your help,

Pascal.
pmonett
 
Posts: 5
Joined: 15. June 2011 09:19


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 55 guests