virtualdomain [multiple site] setup for the complete newb

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

virtualdomain [multiple site] setup for the complete newb

Postby jAQUAN » 13. February 2007 00:52

I've been crawling this board for two days for a simple how-to on how to work on multiple sites. Nothing I've tried has worked. It's a commonly addressed issue here and yet there is no on-ramp tutorial to speak of... anywhere. Izzy's posts have been helpful but I'm not getting something.

I decided to create a thread that hopefully will fill in the blanks so that I can write a comprehensive getting started tut.

My problem: I'm just an html/php/css coder. I don't know squat about web servers or how to configure them. Thus why I'm using a WAMP at all.
I want to simply add VirtualHosts (vhosts) so that I can work on multiple sites.
All I want is be able to do is open this file in my browser:
D:/www/mySite_local/index.html
by typing this into the address bar:
http://mySite_local/

The XAMPP install is in C:\Program Files\xampp

From what I've read, all I should have to do is set my httpd-vhosts.conf file to look like this:
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin stranskydesign@gmail.net
    DocumentRoot D:/www/mySite_local
    ServerName mySite_local.com
    ServerAlias www.mySite_local.com
</VirtualHost>


That allows apache to restart ok but I'm lost from there. http://mySite_local/ just give me the can't find error.

My questions:
1. Is there anything wrong with my httpd-vhosts.conf?
2. Are there any other files I need to edit? (remember this is a default out of the box install)
3. Does my hosts file in system32\drivers\etc have anything to do with it? Do I need to add anything to it?
4. I'm on a network at my office. Does that mess with my ports or otherwise prevent this from working?

Thank ahead of time. I'll so a nice write up once I get it working.
jAQUAN
 
Posts: 6
Joined: 12. February 2007 22:44

Postby Wiedmann » 13. February 2007 01:09

3. Does my hosts file in system32\drivers\etc have anything to do with it? Do I need to add anything to it?

Maybe...

Your browser must know the IP for "mySite_local". You can configure this in your hosts file, or in your dns server.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby jAQUAN » 13. February 2007 01:39

Thanks for the reply.
Can you confirm my other questions?
Are my assumptions about where to store the files locally, what URL to use to see them and additions to httpd-vhosts.conf correct?

I'm not real keen on how fake local IP's work so bare with me.
I thought that this line:
NameVirtualHost *:80
allowed for any IP. Are you saying that one still must be connected somewhere? Is there a dns server running as part of xampp? If not then I have no idea if I should be editing hosts or not.
I read an example that used 10.0.0.10 when adding to the hosts file.
Is that just some abritrary made up IP or does it have meaning?
Would my addition look like this?
10.0.0.10 mySite_local.com

There's already this line in there:
127.0.0.1 localhost
Did the xampp installer add that?

Sorry so many questions but without an understanding of how things are connected I can't grasp some things.
jAQUAN
 
Posts: 6
Joined: 12. February 2007 22:44

Postby Wiedmann » 13. February 2007 01:43

Code: Select all
10.0.0.10 mySite_local.com

Is that just some abritrary made up IP or does it have meaning?

Sure, you must use the real IP of your pc. (or just 127.0.0.1, which you allways have)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby jAQUAN » 13. February 2007 02:02

When I do ipconfig /all, my DNS Servers is 172.16.6.200

Should my hosts file look like this:
Code: Select all
172.0.0.1  localhost
172.16.6.200  mySite_local.com


or like this?

Code: Select all
172.0.0.1  localhost
172.0.0.1  mySite_local.com


Can I put just any path to any local drive as the DocumentRoot inside the <VirtualHost> tag?
jAQUAN
 
Posts: 6
Joined: 12. February 2007 22:44

Postby Wiedmann » 13. February 2007 02:17

Code: Select all
127.0.0.1  localhost
127.0.0.1  mySite_local.com
127.0.0.1  www.mySite_local.com

That's correct. (127.0.0.1 not 172.0.0.1)

BTW:
my DNS Servers is 172.16.6.200
Code: Select all
172.16.6.200  mySite_local.com

I meant, you can make this setting in your DNS server, instead of changing your hosts file. But i think, you have no own DNS server ;-)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby jAQUAN » 13. February 2007 19:12

I have no idea what a dns server is. Did one get installed with xampp?
Thanks for all your help so far Wiedmann.

Does the folder have to have the .com on it?
Does this path look right?
D:/www/mySite_local/index.html

To anyone reading this I've asked a lot of questions here that haven't been answered yet. If I'm not being clear enough let me know.

I need a little explanation along with the answers. There's too many variables here for me to try every combination, please examine my first post in thread and tell me if my file paths are correct.

At the moment, I can get apache to restart with my changes but I get this when I try to view the site.

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
www.mySite_local.com
02/13/07 10:26:07
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0
jAQUAN
 
Posts: 6
Joined: 12. February 2007 22:44

Postby Wiedmann » 13. February 2007 19:21

Does the folder have to have the .com on it?

No, you can also name the folder "hey_baby" ;-)

Does this path look right?
D:/www/mySite_local/index.html

Yes.

But I think we should start over...

On the webserver open a command prompt (cmd.exe)
Type:
Code: Select all
notepad %SystemRoot%\System32\drivers\etc\hosts

(You must be an administrator to do that)

Verify you have this in the file:
Code: Select all
127.0.0.1  localhost
127.0.0.1  mySite_local.com
127.0.0.1  www.mySite_local.com

Save the file and exit notepad.

Now execute these four commands:
Code: Select all
ping 127.0.0.1
ping localhost
ping mySite_local.com
ping www.mySite_local.com


Then come back and post the output (copy 'n paste).
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby jAQUAN » 13. February 2007 20:13

I used textpad to edit the hosts file.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Joel>ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Documents and Settings\Joel>ping localhost

Pinging mrcoffee [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Documents and Settings\Joel>ping mySite_local.com

Pinging mySite_local.com [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Documents and Settings\Joel>ping www.mySite_local.com

Pinging www.mySite_local.com [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Documents and Settings\Joel>
jAQUAN
 
Posts: 6
Joined: 12. February 2007 22:44

Postby Wiedmann » 13. February 2007 21:07

Well, looks good.

In your "httpd-vhosts.conf" you should have this:
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin stranskydesign@gmail.net
    DocumentRoot D:/www/mySite_local
    ServerName mySite_local.com:80
    ServerAlias www.mySite_local.com
    <Directory D:/www/mySite_local>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    <Directory>
</VirtualHost>

(No other changes in "httpd.conf"?)

The directory "D:\www\mySite_local" must exists on the computer.

Start Apache with the batchfile "apache_start.bat" and look if you have error messages.

And now open the same addresses as above in the browser on this computer:
Code: Select all
http://127.0.0.1/
http://localhost/
http://mySite_local.com/
http://www.mySite_local.com/


What happens?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby jAQUAN » 14. February 2007 04:05

Good show man! that worked. I had to correct your closing directory tag but that was it. Here is the output when I ran apache_start.bat

Diese Eingabeforderung nicht waehrend des Running beenden
Bitte erst bei einem gewollten Shutdown schliessen
Please close this command only for Shutdown
Apache 2 is starting ...
[Tue Feb 13 18:50:37 2007] [warn] NameVirtualHost *:80 has no VirtualHosts

Is that bad? The server works and php works so I'm thrilled.
I really really appreciate you taking the time to help me Weidmann. You're assistance was invaluable. I'm going to make another post in this thread that sums up everything I've learned about getting started with vhosts and I'll be sure to give you plenty of credit. :)

Btw, you can look me up at flashkit.com if you ever have any flash questions.
jAQUAN
 
Posts: 6
Joined: 12. February 2007 22:44

Postby nightrider35 » 14. February 2007 14:29

this is the only way to get it to work


Code: Select all
<VirtualHost *:80>
ServerName southcoastsupermotards.no-ip.org:80
DocumentRoot "D:/webserver/xampp/htdocs/southcoastsupermotards.no-ip.org"
<Directory "D:/webserver/xampp/htdocs/southcoastsupermotards.no-ip.org">
Order Allow,Deny
Allow from all
#Options All
#AllowOverride All
</Directory>
</VirtualHost>
nightrider35
 
Posts: 5
Joined: 12. February 2007 23:22

Postby meows » 15. February 2007 11:23

Wow that was a good post! I learned a few things finally!
There is hope for us dummys out here.

I have what I hope is a simple question as I can't get this to work.

I need http://78ez.com/gaming to be the address.. yet no matter what I do I have to include usr in the Http like this http://78ez.com/usr/gaming for it to work.. what do I need to change below to get the Http://78ez.com/gaming to work?

<VirtualHost 75.160.145.121>
ServerName 78ez.com
ServerAlias 78ez.com/gaming
DocumentRoot "F:/www.root.home/usr"
Alias /gaming F:/www.root.home/usr/gaming
<Directory "F:/www.root.home/usr/gaming">
Order Allow,Deny
Allow from all
#Options All
#AllowOverride All
</Directory>
</VirtualHost>
meows
 
Posts: 44
Joined: 31. January 2007 10:28


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 88 guests