apache, jail, 1 IP ...

2003-01-09 Thread i4o beke
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 [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: apache, jail, 1 IP ...

2003-01-09 Thread Kirk Strauser

At 2003-01-09T11:58:54Z, i4o beke [EMAIL PROTECTED] writes:

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

I might try using Squid as a reverse-proxy.  Install BIND9 and configure an
internal view so that userX.sk resolves to the appropriate internal IP, and
let Squid handle the rest for you - that's what it was designed for.
-- 
Kirk Strauser
In Googlis non est, ergo non est.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message