Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 2001 14:05:14 -0600
From:      Ben Weaver <bweaver@tranquility.net>
To:        Arthur <arthur@argay.com.au>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Virtual Server
Message-ID:  <20010211140514.C167@tranquility.net>
In-Reply-To: <003a01c0940f$1ca57680$86391ecb@argay.com.au>; from arthur@argay.com.au on Sun, Feb 11, 2001 at 08:43:39PM %2B1100
References:  <003a01c0940f$1ca57680$86391ecb@argay.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--s9fJI615cBHmzTOP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

The named configuration will be the same as before, you will just use the s=
ame IP address when making A records in different zones.  For instance ig y=
ou host the vhost1.com and vhost2.com domains and you want both of them to =
use IP address 192.168.1.20, you would put this line into the zone files fo=
r each zone:

www	IN	A	192.168.1.20

Now, it's up to apache to figure out what website a request on that IP addr=
ess is for.  It does this using the HTTP header information, so you will ne=
ed to set up your virtual hosts like this:

<VirtualHost 192.168.1.20:80>
Servername www.vhost1.com
DocumentRoot /path/to/document/root
# Put Logfile and other config options you want here
</VirtualHost>

Now, apache will know to direct requests for www.vhost1.com to the right pl=
ace.  Make a similar entry for www.vhost2.com and you'll be all set.  The o=
ne drawback to hosting in this way is if I were to go to http://vhost1.com =
in my browser (assuming you've set the DNS to resolve vhost1.com to 192.168=
.1.20), apache will not know what website I want.  You will have to tell ap=
ache that request for both vhost1.com and www.vhost1.com need to go to the =
same VirtualHost.  You can do this by adding this line to your VirtualHost =
statement:

ServerAlias vhost1.com

or

ServerAlias *.vhost1.com

The last will intercept all requests for anything.vhost1.com and bring up t=
he correct site.  To do this last entry, howeverm be sure to do:

ServerName vhost1.com

instead of

ServerName www.vhost1.com

This is because *.vhost1.com in the ServerAlias statement will not match vh=
ost1.com.

Hope this helps,

-Ben=20

On Sun, Feb 11, 2001 at 08:43:39PM +1100, Arthur wrote:
> HI
>=20
> I am running FBSD 2.2.6 and am intending to upgrade to the 4 series, but
> time is the problem.
>=20
> In the meantime I have virtual servers (Hosts) configures using individual
> IP addresses and the DNS configured accordingly for each zone file for ea=
ch
> server.
>=20
> I now wish to configure virtual servers using the one IP address.
>=20
> How do I go about this  in the httpd.conf file and the named set-up.
>=20
> Thanks in advance.
>=20
> Arthur
>=20
>=20
>=20
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

--s9fJI615cBHmzTOP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE6hvB6lLyqskZtc9ERAu+ZAJ9rmUjOmA3JRwJTmIMgbTWKaDtAKwCfSumO
/iYpr5pehTz0bBSYtyEz464=
=R1Mo
-----END PGP SIGNATURE-----

--s9fJI615cBHmzTOP--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010211140514.C167>