Virtual Host Containers (w/ example) not working, need help

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

Virtual Host Containers (w/ example) not working, need help

Postby destry » 13. September 2005 16:10

Hi, first timer with XAMPP.

I would like to use XAMPP for local development of Web sites built with Textpattern (an open-source CMS). What I really need is to be able to work on multiple sites, preferably all sitting in respective folders under one location...c:\sites\ (e.g., c:\sites\site1, c:\sites\site2, etc.)

My installation of XAMPP went fine, but I need some help with configuring the virtual host containers in the httpd.conf. I must have looked at twenty different examples all over the net, including the ones in the Textpattern wiki, but I can't get anything to work.

My hosts file I think is at least right...

Code: Select all
127.0.0.1   localhost
127.0.0.1   site1.local.com
127.0.0.1   site2.local.com


But I think virtual host containers in the httpd.conf file is where the problem is, I just don't know what exactly. The way I have it below is exactly as it's discussed here...

Code: Select all
NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
ServerAdmin admin@localhost
DocumentRoot /apachefriends/xampp/htdocs/xampp
ServerName localhost
<Directory "/apachefriends/xampp/htdocs/xampp">
Options Indexes FollowSymLinks ExecCGI
</Directory>
</VirtualHost>

NameVirtualHost site1.local.com:80

<VirtualHost 127.0.0.1:80>
ServerAdmin admin@site1.local.com
DocumentRoot C:/MySites/site1
ServerName site1.local.com
<Directory C:/MySites/site1>
Options Indexes FollowSymLinks
AllowOverride FileInfo
</Directory>
</VirtualHost>

NameVirtualHost site2.local.com:80

<VirtualHost 127.0.0.1:80>
ServerAdmin admin@site2.local.com
DocumentRoot C:/MySites/site2
ServerName site2.local.com
<Directory C:/MySites/site2>
Options Indexes FollowSymLinks
AllowOverride FileInfo
</Directory>
</VirtualHost>



Oh, one other thing that might be killing me here. How do you know what your ServerAdmin is? I have it marked above as admin, but I don't have a clue, really, nor how I would go about finding out? (Is it the same as my admin username for my local machine?) I don't recall this ever being a step in the XAMPP install process.

cont... I don't think I've given enough to be fully explanatory, so here's a bit more.

A typical install of the CMS in my desired locations, with the target setup file, would be this...

Code: Select all
c:/MySites/site1/textpattern/setup/index.php


and I'm under the impression, with virtual host containers set up correctly, I should be able to access the setup file in a browser by using...

Code: Select all
http://site1.local.com/textpattern/setup/index.php


But in fact what I get is a 404 error saying "Object not found!", but the files are indeed there.
destry
 
Posts: 2
Joined: 13. September 2005 15:06

Postby Bugman » 14. September 2005 12:25

Hello

Well here is a quick guide.

1. Open up Hosts file in windows >system32>drivers>etc>hosts

I have edited in theses lines:
Code: Select all
127.0.1.1   www.lmambo.com
127.0.1.1   www.local.amambo.com
127.0.1.1   www.local.e107.com
127.0.1.1   www.local.xara.com
127.0.1.1   www.local.plone.com
127.0.1.1   www.local.phpwebsite.com
127.0.1.1   www.local.drupal.com
127.0.1.1   www.local.phpmyadmin.com
127.0.1.1   www.local.nucleus.com

2. Then open up httpd in xmaap>apache>conf and down the bottom (you will have to search for the correct area:

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

<VirtualHost *:80>
  ServerName www.lmambo.com
  DocumentRoot "C:/www/mambo"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.storecore.com:80
  DocumentRoot "C:/www/storecore"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.e107.com:80
  DocumentRoot "C:/www/e107"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.xara.com:80
  DocumentRoot "C:/www/xara"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.amambo.com:80
  DocumentRoot "C:/www/amambo"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.phpwebsite.com:80
  DocumentRoot "C:/www/phpwebsite"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.drupal.com:80
  DocumentRoot "C:/www/drupal"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.phpmyadmin.com:80
  DocumentRoot "C:/www/phpmyadmin"
</VirtualHost>

<VirtualHost *:80>
  ServerName www.local.nucleus.com:80
  DocumentRoot "C:/www/nucleus"
</VirtualHost>


Why have i put .local. in? Well it helps when i am working on real websites and then i know i am not editing the live version as to speak
e.g.
live = www.mywebsite.com
local = www.local.mywebsite.com

Also, put these lines in your httpd
Code: Select all
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/www"

and also:
Code: Select all
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/www">

This is where i put all my websites as you can see from the vitural hosts above. It could be anything, but make sure you make them all the same.

Bugman
Bugman
 
Posts: 53
Joined: 13. July 2004 23:39

Postby destry » 14. September 2005 14:32

Thanks Bugman,

I figured out what went wrong and meant to let you know before you had to do all that, but you beat me to it. Sorry.

I had it all setup like you explain, more or less. It turns out I just had a little error in my 'DocumentRoot' path (missing underscore), which I completely overlooked for several frustrating hours. Sigh

I see you're using XAMPP for one of the same reasons I will be -- testing various systems, among other things.

Cheers.
destry
 
Posts: 2
Joined: 13. September 2005 15:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests