Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jun 2001 18:21:51 GMT
From:      Simon Maycock <smaycock@earthlink.net>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Found my mistake ! Re: natd and Apache Port Based Virtual Hosting
Message-ID:  <20010618.18215100@barney.home.mrhagar.com>
In-Reply-To: <Pine.BSF.4.21.0106181117580.90436-100000@cody.jharris.com>
References:  <Pine.BSF.4.21.0106181117580.90436-100000@cody.jharris.com>

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

So the archives can record my stupidity for ever I wanted to share what =
I=20
had wrong and thank all thoses that helped me!  Hopefully others will=20
learn from my mistake.

For the record I have two FreeBSD boxes connected together, one the=20
gateway and one the Apache server.  The IP's are as follows...

public_IP |gateway| 192.168.2.202 ------- 192.168.2.201 |apache |=20
192.168.1.201 --- internal_network

I had natd correctly setup with the following enteries:

#
log yes
redirect_port tcp 192.168.2.201:80 80
redirect_port tcp 192.168.2.201:8080-8082 8080-8082

All that was wrong was I was referencing the wrong interface in my=20
httpd.conf file! i.e. <VirtualHost 192.168.1.201:8080>

As soon as I changed the .1.201 to .2.201 and restarted apche it worked =

fine.

Thanks again,

Simon


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 6/18/01, 9:47:33 AM, Nick Rogness <nick@rogness.net> wrote regarding =
Re:=20
natd and Apache Port Based Virtual Hosting:


> On Mon, 18 Jun 2001, Simon Maycock wrote:

> > Can anyone tell me how I configure Port based Virtual Hosts in Apach=
e
> > so that they correctly work with translated packets.  It is my
> > understanding that all natd is doing is taking the external address,=

> > striping it and adding an internal address.  If this is the case the=
n
> > I believe the following entries in my httd.conf should be working?
> >
> > # Use name-based virtual hosting.
> > #
> > #NameVirtualHost 192.168.1.201
> > Listen 80
> > Listen 8080
> > Listen 8081
> > Listen 8082
> > #
> > # VirtualHost example:
> > # Almost any Apache directive may go into a VirtualHost container. #=

> > The first VirtualHost section is used for requests without a known #=

> > server name.
> > #
> > <VirtualHost 192.168.1.201:8080>
> >     ServerAdmin a@b.com
> >     DocumentRoot /data/www/abc
> >     ServerName 192.168.1.201:8080
> >     ErrorLog /data/www/abc/logs/error_log
> >     TransferLog /data/www/abc/logs/access_log
> > </VirtualHost>
> >
> > <VirtualHost 192.168.1.201:8082>
> >     ServerAdmin a@b.com
> >     DocumentRoot /data/www/xyz
> >     ServerName 192.168.1.201:8082
> >     ErrorLog /data/www/xyz/logs/error_log
> >     TransferLog /data/www/xyz/logs/access_log
> > </VirtualHost>
> >
> > This works fine from any internal host, but not from external ones, =
which
> > just default to the default site at port 80.

>        <VirtualHost 192.168.1.201:80>
>            ServerAdmin c@d.com
>            DocumentRoot /data/www/cda
>            ServerName 192.168.1.201
>            ErrorLog /data/www/cda/logs/error_log
>            TransferLog /data/www/cda/logs/access_log
>        </VirtualHost>


> > In an attempt to get this problem resolved I have set the firewall t=
o
> > allow all and my rc.conf calls the my natd.conf file containing thes=
e
> > enteries.
> >
> > #
> > log yes
> > redirect_port tcp 192.168.2.201:80 80
> > redirect_port tcp 192.168.2.201:8080-8082 8080-8082
> >
> > Any help will be gratefully received.

>       Is 192.168.1.201 your insdie IP of the same machine that carries=

>       your Public address (natd runs on it)?  If so, then the
>       redirect_port statements above are not necessary.

> Nick Rogness <nick@rogness.net>
>  - Keep on Routing in a Free World...
>   "FreeBSD: The Power to Serve!"

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?20010618.18215100>