apache config
Patrick McManus
mcmanus at appliedtheory.com
Thu Nov 1 16:52:10 EST 2001
[Anand A Rao: Thu, Nov 01, 2001 at 04:26:57PM -0500]
> Hi ,
> I was trying to config apache with virtual IP. My requirement is ..
>
> I have 4 IPs for a machine , I want to run seperate instances of apache for each IP, at diff ports , but I want to browse thru them using just the IP and not the ports.
>
> say like :
I'll state the obvious and say that it would be a lot easier to just
bind your apache's to the apropos interface (instead of * or 0.0.0.0),
run them all on port 80, and be done with it.. but if you want to do
this.. (and I once wanted to do a similar thing in order to run a
server in non-root (and therefore high numbered port) space without
any setuid games) iptables works well here..
>
> http://192.168.1.1 for the one running on poert 80 on this machine
by definition, that's what http://192.168.1.1 means.
> http://192.168.1.2 for the instance listening on port say 8080
iptables -t nat -A PREROUTING -p tcp --dst 192.168.1.2 --dport 80 -j REDIRECT --to-port 8080
that will map it to 192.168.1.2:8080
if you want it mapped to 192.168.1.1:8080 the below would probably
work (this one isn't tested)
iptables -t nat -A PREROUTING -p tcp --dst 192.168.1.2 --dport 80 --to-destination 192.168.1.1 -j REDIRECT --to-port 8080
> and http://192.168.1.2 for the instance listening on port 8100
umm.. you just mapped 192.168.1.2:80 above.. you can't map it again.
More information about the Discuss
mailing list