Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What would be the best set up to direct incoming web requests to servers serving different domains?
I have have a cheap router and am not capable of doing this. Is there a how to on how to set up a linux router to do this? Should I be looking at using Squid as a reverse proxy? I Googled for quite a while now with no success.
Distribution: Slackware, CentOS. Red Hat Enterprise Linux
Posts: 216
Rep:
You want to look at the Virtual Hosts support in Apache, which will allow you to have multiple web sites using different domains all pointed to the same IP address. But be aware this does not work for SSL connections.
I want to run 2 different web servers that server for 2 different domains with one IP. So requests for domain a go to server 1 and requests for domain b goto server 2. I do not want to run both on the same server.
I have 2 old PC acting as web servers now. On the one I run Zope behind Apache and the other runs Apache, MYSQL and Sendmail.
I am just not sure what I need to do to. I rather go with a Linux box acting as a router (low on cash). But I am not sure excatly how to set it up.
To do this you need to look at the Virtual Hosts page on Apache's website. However you also need to run the dns for the Hosts. Example. If i'm hosts www.dogs.com and www.cats.com I would need to run the dns so my computer processes the request for www.dogs.com or www.cats.com and not for the ip address. I recommend bind for running a dns. I use virtual hosts to run my imaps mail servers and two websites with great success.
Kewl, setting up a linux box as a router is not too hard, I run my network through one of my slack boxes. I would recommend you learn iptables since you will be running your own firewall and router. need any help, just let me know.
Distribution: Slackware, CentOS. Red Hat Enterprise Linux
Posts: 216
Rep:
Quote:
I want to run 2 different web servers that server for 2 different domains with one IP. So requests for domain a go to server 1 and requests for domain b goto server 2. I do not want to run both on the same server.
This will be difficult and you will not be able to do it with iptables. The domain part of the web request is in the http data and this is what Apache looks at to handle virtual hosts. To have one IP address and route requests to different servers behind a firewall based on the domain name will require a proxy of some kind that can peek at the http data.
Firewall rules work only with IP addresses. They can lookup host names in their rule sets from DNS, but the the incoming traffic will only have IP addresses and not domain names. So this rules out iptables port forwarding.
This will be difficult and you will not be able to do it with iptables. The domain part of the web request is in the http data and this is what Apache looks at to handle virtual hosts. To have one IP address and route requests to different servers behind a firewall based on the domain name will require a proxy of some kind that can peek at the http data.
Firewall rules work only with IP addresses. They can lookup host names in their rule sets from DNS, but the the incoming traffic will only have IP addresses and not domain names. So this rules out iptables port forwarding.
There are several ways to do this, but you are right, iptables won't route by domain. If I was going to remote host like you say, I would just nfs the remote into the box running apache and then point to the nfs dir for the virtual host.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.