LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can I route web traffic to 2 different hosts based on URL under 1 IP Address? (https://www.linuxquestions.org/questions/linux-networking-3/can-i-route-web-traffic-to-2-different-hosts-based-on-url-under-1-ip-address-321772/)

Marshalle 05-09-2005 05:40 PM

Can I route web traffic to 2 different hosts based on URL under 1 IP Address?
 
I have two internal web servers. One is IIS the other is Apache/Tomcat. Does anyone know if it is possible to have a linux router or something like it to forward traffic to the relevant server based on the url they have entered?

Thanks,

M

jrochamtz 05-09-2005 06:06 PM

what i have done is to set up an internal dns server and add hosts to the zone with their ip address like:

web IN A 10.0.0.1
mail IN A 10.0.0.2

then the url web.mydomain.com goes to 10.0.0.1 and mail.mydomain.com goes to 10.0.0.2

is it what you want to do??

greetings!!

Darin 05-09-2005 06:51 PM

You can also set this up in Apache, possibly in IIS as well.
Point both URLs to the Apache box and then in the apache config, add a redirect. Some info on this can be found at http://httpd.apache.org/docs/mod/mod_alias.html

Marshalle 05-09-2005 07:43 PM

I like both of these solutions, which do you think would be better. Basically it is for this:

IIS running exchange outlook web access
Apache running on Linux for a simple helpdesk app (forgot about that one)
Tomcat for a Java based eccommerce site that could end up with a bit of traffic.

Each of these will be on completely different domain names, but should all be accessible via port 80

One concern I might mention is if the Tomcat server got a lot of traffic it may not be wise having apache doing all the sorting? Also, because of the ecommerce I could see the Linux box doing some load balancing for redundant internet links, so I'm assuming if we are using it like a router Apache would be a bad Idea? ie more of a security risk?

Thanks heaps for any replies!

M

jrochamtz 05-13-2005 09:43 AM

all will be accessed through the same ip??

if yes, I never have done it, but you can forward all packets from the router to the linux box wich contains the virtual domains, then in the virtal domain you choose if deliver local, or redirect to the other server using the redirect directive of the other post.

but i'm not shure it works even if the redirected server is not nated.

NameVirtualHost *:80
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

Marshalle 05-14-2005 03:02 AM

I think I understand what you mean, however there may be other servers added to the mix and while they probably won't be web servers I think it would be good to have the first router handle it (or the first hop). I believe what you are talking about is present in many cheaper routers and is called a DMZ. However it just really means forward all traffic to this ip unless otherwise specified. Is that what you meant?


All times are GMT -5. The time now is 01:25 AM.