httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <>
Subject RE: [users@httpd] multiple ip to the same website
Date Mon, 21 Jul 2003 08:16:40 GMT
>-----Original Message-----
>From: Stand H []
>I want to configure my web server to host multiple web
>site. Each web site I assign a static IP.
>web site A
>web stie B
>web stie C
>When user type,,
>, I want my web server to load web
>site A. Web site B and C can only be reach via it host
>name though they have thier own IP.
>What I have done is put web site A in the server
>config context and web site B and C in the vitual host
>but when I type I always get web
>site B. I don't want to get web site B, I want to get
>only web site A when user access via IP address.
>Thanks in advance.

To achieve what you want, you have to set up name-based VH on the B and
C IPs and then have two name-based VHs per IP. One VH will be the "real"
one which will give you the named site when the user uses server name
and the other will be a dummy which traps IP-only requests and redirects
them to web site A. E.g.


# Dummy which traps IP-only requests - must appear FIRST.
  ServerName dummy
  Redirect /

# Real site for requests to "web_site_B"
  ServerName web_site_B
  DocRoot /path/to/B

... repeat for C.

Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

PS "dummy" doesn't have to be the word "dummy" - it can be any word
which is NOT a servername for web site B. This technique is making use
of the behaviour of apache that if it cannot find a matching name-based
VH for a given IP, it uses the *first* VH it finds for that IP - even if
the names don't match. So, since a request with just the IP address
doesn't contain a name, it cannot match any valid NBVH and so apache
will assign it to the first one - which contains the redirect.

>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>The official User-To-User support forum of the Apache HTTP 
>Server Project.
>See <URL:> for more info.
>To unsubscribe, e-mail:
>   "   from the digest:
>For additional commands, e-mail:
Diese E-mail ist eine private und persönliche Kommunikation. Sie hat
keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Swiss Exchange.
This e-mail is of a private and personal nature. It is not related to
the exchange or business activities of the SWX Swiss Exchange. Le
présent e-mail est un message privé et personnel, sans rapport avec
l'activité boursière de la SWX Swiss Exchange.

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company. 

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message