You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by lists <li...@euca.us> on 2013/09/09 05:38:34 UTC

[users@httpd] name-based vhosts with 2 IP's

Hello,
I'm having a problem matching virtual hosts.

I am using this reference:
http://httpd.apache.org/docs/2.2/vhosts/examples.html

(Specifically the part: "Name-based hosts on more than one IP address.")

An example (snippet) of my config (ubuntu 12.04) is:
-------------------------------------------------
# main landing for maindomain.com (IP: 000.000.000.27)
ServerName maindomain.com
DocumentRoot /var/www/maindomain.com/edc
DirectoryIndex Welcome.tpl


# The rest of the sites
NameVirtualHost 000.000.000.28:80

# firstvhost.com
<VirtualHost 000.000.000.28:80>
         DocumentRoot /var/www/maindomain.com/restsites
         ServerName firstvhost.com
         ServerAlias www.firstvhost.com
         DirectoryIndex Welcome.tpl

         <Directory /var/www/maindomain.com/restsites/>
         ...

---- etc.. SNIP -----

# secondvhost.com
<VirtualHost 000.000.000.28:80>
         DocumentRoot /var/www/maindomain.com/restsites
         ServerName secondvhost.com
         ServerAlias www.secondvhost.com
         DirectoryIndex Welcome.tpl

         <Directory /var/www/maindomain.com/restsites/>
         ...

--------------------------------------------------

The result I am seeing is that no matter what domain I put in that is 
routed to my server, the landing is always:

/var/www/maindomain.com/edc/Welcome.tpl

When, for example, I am expecting
/var/www/maindomain.com/restsites/Welcome.tpl

to be root if I type "www.firstvhost.com" or "www.secondvhost.com" in 
the browser. Can someone point me where I'm going wrong?

Note, both www.firstvhost.com www.secondvhost.com traceroute to the .28 
IP address.

Thanks!

Donovan




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] name-based vhosts with 2 IP's

Posted by lists <li...@euca.us>.
Okay,... solved, and I didn't supply enough info to the list.

The problem was that this server is behind a firewall and the actual IP 
is a local IP. Once I set a NameVirtualHost to the local IP, changed the 
<VirtualHost..> to use it, then reload the apache config.. all worked 
correctly.

Thanks,
Donovan



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] name-based vhosts with 2 IP's

Posted by Stefan Pielmeier <st...@symlinux.com>.
Try with nmap <ip>, or with telnet <ip> 80

Stefan Pielmeier
from mobile device


On 9 Sep 2013, at 17:01, lists <li...@euca.us> wrote:

> On 9/9/13 5:52 AM, Eric Covener wrote:
>> On Sun, Sep 8, 2013 at 11:38 PM, lists <li...@euca.us> wrote:
>>> <VirtualHost 000.000.000.28:80>
>>>         DocumentRoot /var/www/maindomain.com/restsites
>>> <VirtualHost 000.000.000.28:80>
>>>         DocumentRoot /var/www/maindomain.com/restsites
>> 
>>> to be root if I type "www.firstvhost.com" or "www.secondvhost.com" in the
>>> browser. Can someone point me where I'm going wrong?
>> 
>> Maybe httpd does not recieve the connection on an interface that
>> matches 000.000.000.28?
> 
> 
> Hmmm, that's what I was wondering. Is there a way to check this? The NIC is set, and 'Listen' is set to "80".
> 
> DNS for the domains linked to xxxx.28 make it to the server.
> 
> Thanks for the help.. new to this kind of config,
> Donovan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] name-based vhosts with 2 IP's

Posted by lists <li...@euca.us>.
On 9/9/13 5:52 AM, Eric Covener wrote:
> On Sun, Sep 8, 2013 at 11:38 PM, lists <li...@euca.us> wrote:
>> <VirtualHost 000.000.000.28:80>
>>          DocumentRoot /var/www/maindomain.com/restsites
>> <VirtualHost 000.000.000.28:80>
>>          DocumentRoot /var/www/maindomain.com/restsites
>
>> to be root if I type "www.firstvhost.com" or "www.secondvhost.com" in the
>> browser. Can someone point me where I'm going wrong?
>
> Maybe httpd does not recieve the connection on an interface that
> matches 000.000.000.28?


Hmmm, that's what I was wondering. Is there a way to check this? The NIC 
is set, and 'Listen' is set to "80".

DNS for the domains linked to xxxx.28 make it to the server.

Thanks for the help.. new to this kind of config,
Donovan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] name-based vhosts with 2 IP's

Posted by Eric Covener <co...@gmail.com>.
On Sun, Sep 8, 2013 at 11:38 PM, lists <li...@euca.us> wrote:
> <VirtualHost 000.000.000.28:80>
>         DocumentRoot /var/www/maindomain.com/restsites
> <VirtualHost 000.000.000.28:80>
>         DocumentRoot /var/www/maindomain.com/restsites

> to be root if I type "www.firstvhost.com" or "www.secondvhost.com" in the
> browser. Can someone point me where I'm going wrong?

Maybe httpd does not recieve the connection on an interface that
matches 000.000.000.28?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] name-based vhosts with 2 IP's

Posted by lists <li...@euca.us>.
On 9/8/13 11:07 PM, Yehuda Katz wrote:
> apache2ctl -S


Thanks, Yes, it's listening:
000.000.000.28:80      is a NameVirtualHost
          default server firstdomain.com 
(/etc/apache2/sites-enabled/edcmeals-conf:11)
port 80 namevhost firstdomain.com 
(/etc/apache2/sites-enabled/edcmeals-conf:11)
etc..

Donovan



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] name-based vhosts with 2 IP's

Posted by Yehuda Katz <ye...@ymkatz.net>.
Ubuntu moves some of the configuration around in the default installation,
so you need to make sure you are putting things where it expects if you
installed from apt.

The first thing to check is if apache is listening for those vhosts. Look
at the output of `apache2ctl -S` for your vhosts (you might need sudo).


On Sun, Sep 8, 2013 at 11:38 PM, lists <li...@euca.us> wrote:

> Hello,
> I'm having a problem matching virtual hosts.
>
> I am using this reference:
> http://httpd.apache.org/docs/**2.2/vhosts/examples.html<http://httpd.apache.org/docs/2.2/vhosts/examples.html>
>
> (Specifically the part: "Name-based hosts on more than one IP address.")
>
> An example (snippet) of my config (ubuntu 12.04) is:
> ------------------------------**-------------------
> # main landing for maindomain.com (IP: 000.000.000.27)
> ServerName maindomain.com
> DocumentRoot /var/www/maindomain.com/edc
> DirectoryIndex Welcome.tpl
>
>
> # The rest of the sites
> NameVirtualHost 000.000.000.28:80
>
> # firstvhost.com
> <VirtualHost 000.000.000.28:80>
>         DocumentRoot /var/www/maindomain.com/**restsites<http://maindomain.com/restsites>
>         ServerName firstvhost.com
>         ServerAlias www.firstvhost.com
>         DirectoryIndex Welcome.tpl
>
>         <Directory /var/www/maindomain.com/**restsites/<http://maindomain.com/restsites/>
> >
>         ...
>
> ---- etc.. SNIP -----
>
> # secondvhost.com
> <VirtualHost 000.000.000.28:80>
>         DocumentRoot /var/www/maindomain.com/**restsites<http://maindomain.com/restsites>
>         ServerName secondvhost.com
>         ServerAlias www.secondvhost.com
>         DirectoryIndex Welcome.tpl
>
>         <Directory /var/www/maindomain.com/**restsites/<http://maindomain.com/restsites/>
> >
>         ...
>
> ------------------------------**--------------------
>
> The result I am seeing is that no matter what domain I put in that is
> routed to my server, the landing is always:
>
> /var/www/maindomain.com/edc/**Welcome.tpl<http://maindomain.com/edc/Welcome.tpl>
>
> When, for example, I am expecting
> /var/www/maindomain.com/**restsites/Welcome.tpl<http://maindomain.com/restsites/Welcome.tpl>
>
> to be root if I type "www.firstvhost.com" or "www.secondvhost.com" in the
> browser. Can someone point me where I'm going wrong?
>
> Note, both www.firstvhost.com www.secondvhost.com traceroute to the .28
> IP address.
>
> Thanks!
>
> Donovan
>
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.**apache.org<us...@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org
>
>