natd & virtual hosting

Eli K. Breen eli at gopostal.ca
Tue Mar 23 16:10:33 PST 2004


Just to wrap up this thread (although it has left the realm of 
FreeBSD-specific)

This worked perfectly! (Apache2 only)
*Note that the redirections can be to internal-only addresses providing 
you leave ProxyRequests off.

Adding an internal alias to the BSD box and binding the alternate httpd 
to that IP then using that IP as the Proxy destination worked flawlessly.

Also need to add the following to httpd.conf

LoadModule proxy_module libexec/apache2/mod_proxy.so
#Not sure if you need both of the following...
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so


<IfModule mod_proxy.c>
ProxyRequests Off

<Proxy *>
     Order deny,allow
     Allow from all
</Proxy>

Cheers,

-E-


Matthew Seaman wrote:
> On Mon, Mar 22, 2004 at 11:15:10AM -0800, Eli K. Breen 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?

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



More information about the freebsd-stable mailing list