Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jan 2003 12:58:54 +0100
From:      i4o beke <bsd@creon.profinet.sk>
To:        freebsd-questions@freebsd.org
Subject:   apache, jail, 1 IP ...
Message-ID:  <20030109125854.B10927@creon.profinet.sk>

next in thread | raw e-mail | index | archive | help
problem description:
- 1 internet ip address, let's say 1.2.3.4 ( hostname: main_user.sk )
- 5 friends. Sharing freebsd box. Everyone is heavily experimenting with
  apache so 5 jails running. 
- every jail has ip address, private range ip adress 192.168.0.x ( we
  were given only 1 public ip)
- every user wants run his own apache, probably later also customers in
  his own jail, every user owns domain 'userX.sk' ,
- host box 1.2.3.4 runs dns, mail, www 
- dns record for 'user1.sk,user2.sk, ... userX.sk' points to 1.2.3.4

And now my problem. How to redirect incoming http request into jail,
based on hostname request, transparently for www client?

Right now i'm doing this through mod_rewrite on host box:

RewriteCond %{HTTP_HOST} http://user1.sk
RewriteRule ^/(.*)$   http://main_user.sk:81/$1 [R]

RewriteCond %{HTTP_HOST} http://user2.sk
RewriteRule ^/(.*)$   http://main_user.sk:82/$1 [R]

RewriteCond %{HTTP_HOST} http://user3.sk
RewriteRule ^/(.*)$   http://main_user.sk:83/$1 [R]
and so on...

Then ipnat:
rdr ep0 1.2.3.4 port 81 -> 192.168.0.1 port 80
rdr ep0 1.2.3.4 port 82 -> 192.168.0.2 port 80
rdr ep0 1.2.3.4 port 83 -> 192.168.0.3 port 80
and so on...

Problem with this solution is  'internal ip' instead of 'hostname' in address
field of browser and bad accesibility to non 80 ports from behind firewall.

I'd like to know, if exists more elegant solution, possibly port 80
solution.
Mod_proxy doesn't seem to work in this case ( or i don't know how to properly use it ;-)

--
  i4o



----- End forwarded message -----

-- 

    ico beke
    bsd at host.sk
    ico at beke.sk

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?20030109125854.B10927>