Virtual Host - local only

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

Virtual Host - local only

Postby pactum » 23. March 2006 11:14

Sorry for being dense, but it's not clear to me... I am struggling to use the method on the xampptutorials.com site. (The site went down there, just as I was posting my question; hence my decision to post here.) I was working with the "pre-1.5.1" method of setting up virtual hosts (I've got 1.4.13).

With said method, do I now need to be saving my actual files in the www/whatever folder rather than in htdocs/whatever? Or is this method intended to have the htdocs "recognized" as if they were in the www folder? I've been attempting it both ways: from an existing site stored in htdocs (note again, I'm on 1.4.13); and from a new test site in the www folder. My httpd.conf file looks like this:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot C:/xampp/xampp/htdocs [I've also tried with simply DocumentRoot C:/xampp/htdocs]
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:/www/pactum3
ServerName localhost.pactum3
</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:/www/test
ServerName localhost.test
</VirtualHost>

... and my HOSTS file looks like this:

127.0.0.1 localhost
127.0.0.1 localhost.pactum3
127.0.0.1 localhost.test

I can't seem to get either one of these to work. But maybe I'm missing another step... this, for example:

http://localhost.pactum3/

.. gives me a xampp Splash page by default:

http://localhost.pactum3/xampp/splash.php

The same holds true for this:

http://localhost.test

..which brings up this:

http://localhost.test/xampp/splash.php

(Both my htdocs/pactum3 directory and my www/test directory have index.php files in them.)

What have I missed? Thanks!

Once again: I've used xampp for about a year, but have never done the virtual hosts thing. The only reason I want to do it now is because I want to use site root relative links and have Apache recognize the proper root of the site. I.e. I'm not interested in using my computer as a public server. In short, my interest is in LOCAL TESTING only.
pactum
 
Posts: 5
Joined: 23. March 2006 11:05

Postby WorldDrknss » 23. March 2006 12:38

Sorry about that I rebooted the server and didnt realize someone was on intill I did it.

uninstall 1.4.13 and install 1.5.1 and follow the flash tutorials on http://xampptutorials.com
or follow http://www.xampptutorials.com/readartic ... ticle_id=1 (Which covers the old version for installation and virtualhost, as well as installation for the 1.5.1, seperate tutorial for virtualhost 1.5.1) or check out http://xampptutorials.com/downloads/httpd.swf which is how the old httpd.conf looked like when I ran the older version.

http://xampptutorials.com
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

Postby pactum » 23. March 2006 17:25

WorldDrknss wrote:Sorry about that I rebooted the server and didnt realize someone was on intill I did it.

uninstall 1.4.13 and install 1.5.1 and follow the flash tutorials on http://xampptutorials.com
or follow http://www.xampptutorials.com/readartic ... ticle_id=1


Thanks. Yes, this: http://www.xampptutorials.com/readartic ... ticle_id=1 is the tutorial I was following. Your server went down while I was posting my question (pretty much as above), after I had tried to work through your instructions. What do I need to do differently?

Thanks!
pactum
 
Posts: 5
Joined: 23. March 2006 11:05

Postby WorldDrknss » 24. March 2006 02:10

trying using .com after the names like localhost.test.com and add those to your hosts file and see if that helps
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

Postby pactum » 24. March 2006 04:03

Thanks... as I noted, these are for local testing only. I can use the Virtual Host system for that, no?

Unfortunately, I tried reverting to what I had before, and now I can't get things to work like I had it. Maybe Notepad did something to the files, I don't know. :(
pactum
 
Posts: 5
Joined: 23. March 2006 11:05

Postby WorldDrknss » 24. March 2006 08:24

pactum wrote:Thanks... as I noted, these are for local testing only. I can use the Virtual Host system for that, no?

Unfortunately, I tried reverting to what I had before, and now I can't get things to work like I had it. Maybe Notepad did something to the files, I don't know. :(


as for this:
pactum wrote:I can use the Virtual Host system for that, no?

well thats incorrect
You dont fully understand, you want to use something like localhost.test.com even though its a .com name, it will still be local, thats the reason why you add them to the hosts file, so when it see that name it will connect through the loopback aka 127.0.0.1 and It nevers reaches the outside, and in return will bring up what you have defined in your virtualhost configuration.

http://xampptutorials.com
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

Postby pactum » 24. March 2006 09:43

WorldDrknss wrote:as for this:
pactum wrote:I can use the Virtual Host system for that, no?

well thats incorrect


Incorrect? You continue on to say that it's possible.

Anyway...

I downloaded 1.5.1 and am now trying to get that going. Here is what I have done:

1. Placed a site (pactumweb) in C:/www

2. Defined my HOSTS file thus:

127.0.0.1 localhost
127.0.0.1 localhost.pactumweb.com

3. Followed the instructions here:

http://www.xampptutorials.com/readartic ... ticle_id=5

by a) changing Deny from all to Allow from all

and b) setting up httpd-vhosts.conf this way:

<VirtualHost *:80>
DocumentRoot /www/pactumweb
ServerName localhost.pactumweb.com
</VirtualHost>

Results:

When I call up http://localhost.pactumweb.com, I get the xampp splash page (including if I call my own index.php file specifically). If I specify another page within that directory, I get an Object Not Found!/404 error.

I've tried renaming the directory itself to pactumweb.com, but with the same results.

What am I missing here?

Thanks!
pactum
 
Posts: 5
Joined: 23. March 2006 11:05

Postby pactum » 26. March 2006 08:53

Still no luck. :(

I moved my files inside the xampp folder to see if it would help. Still not getting virtual domains.

I'm now running 1.5.1. I've set up my httpd-vhosts.conf like this:

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot C:/xampp/xampp/htdocs
ServerName localhost
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot C:/xampp/xampp/htdocs/pactumweb
ServerName localhost.pactumweb
</VirtualHost>

etc. (I've also tried with the *:80 instead of 127.0.0.1.)

I still have the hosts file as earlier:

127.0.0.1 localhost
127.0.0.1 localhost.pactumweb
127.0.0.1 localhost.pactum3

etc.

When I browse to this: http://localhost.pactumweb ... I get a "Server not Found" error (Firefox) or "The Page cannot be displayed" (IE).

I *can* get Apache to show my page if I go here: http://localhost/pactumweb/ (i.e. if I use the forward slash instead of the "dot")

.. but it's not acting as a proper virtual domain - my site root relative links and files don't work - and that's the whole point of me wanting to set up these virtual domains locally.

Any ideas, anyone?
pactum
 
Posts: 5
Joined: 23. March 2006 11:05

Postby adamantium » 01. August 2006 18:00

pactum,

Have you found a solution. I am having the same problem. I tried to add a virtual host which points to a folder inside the htdocs folder, but when I go there, I get redirected to the XAMPP splash page.
adamantium
 
Posts: 1
Joined: 21. March 2006 18:03


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 82 guests