httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] multiple ip to the same website
Date Mon, 21 Jul 2003 08:16:40 GMT
>-----Original Message-----
>From: Stand H [mailto:hstandit@yahoo.com]
>
>I want to configure my web server to host multiple web
>site. Each web site I assign a static IP.
>web site A 192.168.0.1
>web stie B 192.168.0.2
>web stie C 192.168.0.3
>When user type http://192.168.0.1, http://192.168.0.2,
>http://192.168.0.3, 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 http://192.168.0.2 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.

NameVirtualHost 192.168.0.2

# Dummy which traps IP-only requests - must appear FIRST.
<VH 192.168.0.2>
  ServerName dummy
  Redirect / http://192.168.0.1/
</VH>

# Real site for requests to "web_site_B"
<VH 192.168.0.2>
  ServerName web_site_B
  DocRoot /path/to/B
</VH>

... repeat for C.

Rgds,
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.

>
>Stand
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP 
>Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message