natd & virtual hosting

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Mar 22 11:48:50 PST 2004


On Mon, Mar 22, 2004 at 11:15:10AM -0800, Eli K. Breen wrote:
> 
> Janet Sullivan wrote:
> > > I'm trying to host a few services under a few different domain names and
> > > need to be running multiple webservers to do it (apache 1.3x and 2.x).
> > >
> > > If I have a single IP, will nat with FreeBSD 4.9 allow me to separate
> > > requests by domain name even if they share an IP?
> >
> >NAT works with IP addresses.  Why can't you just use Virtual Hosts in 
> >Apache?  Do you really need to run both versions?  
> 
> Yes. Unfortunately. (Slash does not run on 2.x, many of the sites 
> require 2.x)
> 
> I am already running virtual hosts on apache, there are many more than 
> two sites, I've just simplified it for the sake of clarity.
> 
> >If so, what you need 
> >to do is something like this:
> >
> >Apache 1.3x runs on port 80
> >Apache 2.x runs on port 8080
> >
> > redirect 192.168.5.1:80 to 123.123.123.123:80
> > redirect 192.168.5.2:80 to 123.123.123.123:8080
> >
> 
> Also not an option, have tried this before, all manner of people run in 
> to access problems. Giving out your website as www.foo.com:8080 is just 
> weak. (redirects from a :80 fare no better due to the access problems).
> 

A good trick is to set up all of the virtual hosts you need in the
server listening on port 80 (presumably this is your apache-1.3.x
server), and then use mod_proxy to fetch the content from the server
on port 8080 (presumably the apache-2.0.x server).  Something like:

    <VirtualHost *:80>
        ServerAdmin  webmaster at example.com
        ServerName   www8080.example.com
        DocumentRoot "/usr/local/www/www8080.example.com/"  # Not sure if this
                                                            # is necessary
    
        <IfModule mod_proxy.c>
            ProxyPass        / http://www8080.example.com:8080/
            ProxyPassReverse / http://www8080.example.com:8080/
        </IfModule>
    </VirtualHost>
    
	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20040322/fa940315/attachment.bin


More information about the freebsd-stable mailing list