Vhosts

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

Vhosts

Postby Ambictus » 01. June 2009 23:21

I've done a search and can't seem to find a solution to my problem.

I'm trying to host 2 sites on 1 box. I only have 1 IP.
I've un#ed the following line in httpd.conf

Code: Select all
Include etc/extra/httpd-vhosts.conf


And my httpd-vhosts.conf looks like this:

Code: Select all
<VirtualHost *:80>
ServerName wownerdz.com
DocumentRoot /opt/lampp/htdocs/nerdz
</VirtualHost>

<VirtualHost *:80>
ServerName kdscrapbooking.com
DocumentRoot /opt/lampp/htdocs/kdscrap
</VirtualHost>


However when I go to one(doesn't matter which) it simply defaults to the first domain(wownerdz.com).

I've switched the placement of the 2 and when I do it defaults to the other(kdscrapbooking.com).

I can't ever get both to work, just one or the other depending on which is first in the httpd-vhosts.conf file.
Ambictus
 
Posts: 6
Joined: 08. September 2008 19:06

Re: Vhosts

Postby Wiedmann » 02. June 2009 20:56

It seems a NameVirtualHosts directive is missing.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Vhosts

Postby Ambictus » 10. June 2009 21:38

Ok, so under httpd-vhosts.conf I put:

Code: Select all
NameVirtualHost 64.55.41.214:80


When I restart xampp I get the following as it stops apache:

[Wed Jun 10 14:29:41 2009] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Wed Jun 10 14:29:41 2009] [warn] NameVirtualHost 64.55.41.214:80 has no VirtualHosts

The 2nd domain also still points to the first domain. So I try the following:

Code: Select all
<VirtualHost 64.55.41.214:80>
ServerName wownerdz.com
DocumentRoot /opt/lampp/htdocs/nerdz
</VirtualHost>

<VirtualHost 64.55.41.214:80>
ServerName kdscrapbooking.com
DocumentRoot /opt/lampp/htdocs/kdscrap
</VirtualHost>


I then restart apache and receive no error. However when I attempt to go to either website it goes to the htdocs folder. Each domain has a subfolder in the htdocs folder as the DocumentRoot statements show. What in the world am I doing wrong? Is it simply that you can't run 2 websites on port 80 with 1 machine and 1 IP?
Ambictus
 
Posts: 6
Joined: 08. September 2008 19:06

Re: Vhosts

Postby Ambictus » 10. June 2009 21:47

After playing with it some I think that there is something wrong with directories. For whatever reason it defaults to the htdocs folder and not the actual folder of the domain. Any ideas?
Ambictus
 
Posts: 6
Joined: 08. September 2008 19:06

Re: Vhosts

Postby Wiedmann » 10. June 2009 21:55

64.55.41.214

That's an IP from a network interface in this server?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Vhosts

Postby Ambictus » 10. June 2009 22:22

Wiedmann wrote:
64.55.41.214

That's an IP from a network interface in this server?


No... that's a live IP that points to our box from our router with 1-to-1 nat. However I've also set it to 127.0.0.1 and the internal IP of the box. Now the weird issue with it going only to htdocs has stopped but it still only points to the first site in the vhosts list. Here's my entire vhost file.

Code: Select all
#
# Use name-based virtual hosting.
#
NameVirtualHost 10.10.10.187: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 10.10.10.187:80>
ServerName wownerdz.com
DocumentRoot /opt/lampp/htdocs/nerdz
</VirtualHost>

<VirtualHost 10.10.10.187:80>
ServerName kdscrapbooking.com
DocumentRoot /opt/lampp/htdocs/kdscrap
</VirtualHost>
Ambictus
 
Posts: 6
Joined: 08. September 2008 19:06

Re: Vhosts

Postby Wiedmann » 10. June 2009 22:25

that's a live IP that points to our box from our router with 1-to-1 nat.

This must be the IP from your network interface. (the target IP from NAT port-forwarding)

BTW: 127.0.0.1 is not such an IP.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Vhosts

Postby Ambictus » 10. June 2009 22:52

Wiedmann wrote:This must be the IP from your network interface. (the target IP from NAT port-forwarding)

BTW: 127.0.0.1 is not such an IP.


I've also tried the address from my eth0 interface. It's actually set to that now. Still not working for whatever reason.

127.0.0.1 is an IP address and it's assigned to the loopback interface. It should work just dandy for anything locally considering localhost points to it.

Thanks for all your help Wiedmann. Hope I can figure it out soon :)
Ambictus
 
Posts: 6
Joined: 08. September 2008 19:06

Re: Vhosts

Postby Wiedmann » 10. June 2009 23:05

127.0.0.1 is an IP address

I know... But using 127.0.0.1 works only for access from the server pc (and if "nslookup wownerdz.com" returns 127.0.0.1).
--> I don't think you want only have local access?

Hope I can figure it out soon

Well, both domains are working for me (with different content)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Vhosts

Postby Ambictus » 21. June 2009 02:56

Wiedmann wrote:
127.0.0.1 is an IP address

I know... But using 127.0.0.1 works only for access from the server pc (and if "nslookup wownerdz.com" returns 127.0.0.1).
--> I don't think you want only have local access?

Hope I can figure it out soon

Well, both domains are working for me (with different content)



They both return the same page for me, even from different computers in different locations(work vs. home). This is pretty darn annoying. Maybe I should just create a new server with a clean install of apache, php, mysql etc. Perhaps I should install them separately as it's essentially a production environment.
Ambictus
 
Posts: 6
Joined: 08. September 2008 19:06

Re: Vhosts

Postby Wiedmann » 21. June 2009 10:03

They both return the same page for me,

Not for me:
- with "wownerdz.com" I get a forum "Where the Nerdz roam.".
- with "kdscrapbooking.com" I get a white page with just "KDScrapbooking.com" on it.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 18 guests