You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by ipmanux <ip...@gmail.com> on 2011/12/01 10:34:37 UTC

Virtual host and DNS record

Dear all,

I am using RHEL with HTTPD+TOMCAT, I configured  4 VHOSTs on the same server

   -3 VHOST (named-based)
          1st  vhost: www.abc.com
          2nd vhost: www.def.com
          3rd  vhost: www.ghi.com

   -1 VHOST(IP-based) 
          www.klm.com

My DNS record are  for the 3 VHOST (named-based)   pointing to 192.168.1.2
  and    for  the  VHOST(IP-based)    pointing to an alias 192.168.1.3

In case someone create a DNS entry pointing to one of my 2 IP address for
example:
                   www.someone.com   ->  192.168.1.2

How to config Apache to not respond or redirect to a error page when an end
user browse this URL:www.someone.com ?

Regards,
Ipmanux
-- 
View this message in context: http://old.nabble.com/Virtual-host-and-DNS-record-tp32890382p32890382.html
Sent from the Apache HTTP Server - Dev mailing list archive at Nabble.com.


Virtual host and DNS record

Posted by ipmanux <ip...@gmail.com>.
Thanks Tom for your answer,

But it's not working for the IP-based part, what is the default vhost for
IP-based vhost?

Also i am using IP-based because of SSL on "one" Name-based vhost and SSL
the  Ip-based vhost.

Regards,
 


Tom Evans-3 wrote:
> 
> On Thu, Dec 1, 2011 at 9:34 AM, ipmanux <ip...@gmail.com> wrote:
>>
>> Dear all,
>>
>> I am using RHEL with HTTPD+TOMCAT, I configured  4 VHOSTs on the same
>> server
>>
>>   -3 VHOST (named-based)
>>          1st  vhost: www.abc.com
>>          2nd vhost: www.def.com
>>          3rd  vhost: www.ghi.com
>>
>>   -1 VHOST(IP-based)
>>          www.klm.com
>>
>> My DNS record are  for the 3 VHOST (named-based)   pointing to
>> 192.168.1.2
>>  and    for  the  VHOST(IP-based)    pointing to an alias 192.168.1.3
>>
>> In case someone create a DNS entry pointing to one of my 2 IP address for
>> example:
>>                   www.someone.com   ->  192.168.1.2
>>
>> How to config Apache to not respond or redirect to a error page when an
>> end
>> user browse this URL:www.someone.com ?
>>
> 
> The first vhost for a particular vhost spec (eg, the first
> <VirtualHost *:80> or the first <VirtualHost 1.2.3.4:80>, depending on
> what you have for NameVirtualHost) is the default vhost. When a
> request comes in for a domain name that is not served by any of your
> vhosts, it will be served from the default vhost.
> 
> Hence, if you want unknown domains to error, your first vhost should
> handle this. Eg:
> 
> <VirtualHost *:80>
>     # The default/error vhost, no ServerName required
>     DocumentRoot /var/www/sites/error
> </VirtualHost>
> 
> <VirtualHost *:80>
>     ServerName foo.com
> </VirtualHost>
> 
> Cheers
> 
> Tom
> 
> 

-- 
View this message in context: http://old.nabble.com/Virtual-host-and-DNS-record-tp32890382p32902970.html
Sent from the Apache HTTP Server - Dev mailing list archive at Nabble.com.


Re: Virtual host and DNS record

Posted by Tom Evans <te...@googlemail.com>.
2011/12/1 Igor Galić <i....@brainsware.org>:
> users@ might have been a better place for this.

ack. Sorry, didn't notice the OP sent to dev, I would have redirected.

Cheers

Tom

Re: Virtual host and DNS record

Posted by Igor Galić <i....@brainsware.org>.

----- Original Message -----
> On Thu, Dec 1, 2011 at 9:34 AM, ipmanux <ip...@gmail.com> wrote:
> >
> > Dear all,
> >
> > I am using RHEL with HTTPD+TOMCAT, I configured  4 VHOSTs on the
> > same server
> >
> >   -3 VHOST (named-based)
> >          1st  vhost: www.abc.com
> >          2nd vhost: www.def.com
> >          3rd  vhost: www.ghi.com
> >
> >   -1 VHOST(IP-based)
> >          www.klm.com
> >
> > My DNS record are  for the 3 VHOST (named-based)   pointing to
> > 192.168.1.2
> >  and    for  the  VHOST(IP-based)    pointing to an alias
> >  192.168.1.3
> >
> > In case someone create a DNS entry pointing to one of my 2 IP
> > address for
> > example:
> >                   www.someone.com   ->  192.168.1.2
> >
> > How to config Apache to not respond or redirect to a error page
> > when an end
> > user browse this URL:www.someone.com ?
> >
> 
> The first vhost for a particular vhost spec (eg, the first
> <VirtualHost *:80> or the first <VirtualHost 1.2.3.4:80>, depending
> on
> what you have for NameVirtualHost) is the default vhost. When a
> request comes in for a domain name that is not served by any of your
> vhosts, it will be served from the default vhost.
> 
> Hence, if you want unknown domains to error, your first vhost should
> handle this. Eg:
> 
> <VirtualHost *:80>
>     # The default/error vhost, no ServerName required
>     DocumentRoot /var/www/sites/error
> </VirtualHost>
> 
> <VirtualHost *:80>
>     ServerName foo.com
> </VirtualHost>

users@ might have been a better place for this.

> Cheers
> 
> Tom
> 

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


Re: Virtual host and DNS record

Posted by Tom Evans <te...@googlemail.com>.
On Thu, Dec 1, 2011 at 9:34 AM, ipmanux <ip...@gmail.com> wrote:
>
> Dear all,
>
> I am using RHEL with HTTPD+TOMCAT, I configured  4 VHOSTs on the same server
>
>   -3 VHOST (named-based)
>          1st  vhost: www.abc.com
>          2nd vhost: www.def.com
>          3rd  vhost: www.ghi.com
>
>   -1 VHOST(IP-based)
>          www.klm.com
>
> My DNS record are  for the 3 VHOST (named-based)   pointing to 192.168.1.2
>  and    for  the  VHOST(IP-based)    pointing to an alias 192.168.1.3
>
> In case someone create a DNS entry pointing to one of my 2 IP address for
> example:
>                   www.someone.com   ->  192.168.1.2
>
> How to config Apache to not respond or redirect to a error page when an end
> user browse this URL:www.someone.com ?
>

The first vhost for a particular vhost spec (eg, the first
<VirtualHost *:80> or the first <VirtualHost 1.2.3.4:80>, depending on
what you have for NameVirtualHost) is the default vhost. When a
request comes in for a domain name that is not served by any of your
vhosts, it will be served from the default vhost.

Hence, if you want unknown domains to error, your first vhost should
handle this. Eg:

<VirtualHost *:80>
    # The default/error vhost, no ServerName required
    DocumentRoot /var/www/sites/error
</VirtualHost>

<VirtualHost *:80>
    ServerName foo.com
</VirtualHost>

Cheers

Tom