LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-28-2005, 08:58 PM   #1
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Rep: Reputation: 78
Single IP, multible web servers


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.
 
Old 12-28-2005, 11:31 PM   #2
centauricw
Member
 
Registered: Dec 2005
Location: Lawrenceville GA
Distribution: Slackware, CentOS. Red Hat Enterprise Linux
Posts: 216

Rep: Reputation: 31
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.
 
Old 12-29-2005, 12:12 AM   #3
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Original Poster
Rep: Reputation: 78
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.
 
Old 12-29-2005, 12:16 AM   #4
sherman22
LQ Newbie
 
Registered: Mar 2005
Location: Centerville, Iowa
Distribution: Slackware
Posts: 8

Rep: Reputation: 0
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.
 
Old 12-29-2005, 06:34 PM   #5
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Original Poster
Rep: Reputation: 78
Thanks, I play around with it.
 
Old 12-29-2005, 07:40 PM   #6
sherman22
LQ Newbie
 
Registered: Mar 2005
Location: Centerville, Iowa
Distribution: Slackware
Posts: 8

Rep: Reputation: 0
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.
 
Old 12-29-2005, 10:40 PM   #7
centauricw
Member
 
Registered: Dec 2005
Location: Lawrenceville GA
Distribution: Slackware, CentOS. Red Hat Enterprise Linux
Posts: 216

Rep: Reputation: 31
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.
 
Old 12-30-2005, 12:19 PM   #8
sherman22
LQ Newbie
 
Registered: Mar 2005
Location: Centerville, Iowa
Distribution: Slackware
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by centauricw
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.
 
Old 12-30-2005, 01:06 PM   #9
flashingcurser
Member
 
Registered: Jan 2003
Distribution: many win/nix/mac
Posts: 259

Rep: Reputation: 32
Quick question:

Are you trying to share the load between the 2 servers?


dan
 
Old 12-30-2005, 02:45 PM   #10
tangle
Senior Member
 
Registered: Apr 2002
Location: Arbovale, WV
Distribution: Slackware
Posts: 1,761

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by flashingcurser
Quick question:

Are you trying to share the load between the 2 servers?


dan
No, just want to server 2 website with different domains on seperate servers.
 
Old 01-11-2006, 11:03 AM   #11
flashingcurser
Member
 
Registered: Jan 2003
Distribution: many win/nix/mac
Posts: 259

Rep: Reputation: 32
Unless there is a very specific reason to have sites on different computers, as mentioned above, use virtual hosts on one computer to host both sites.




dan
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Single IP multible domain names tangle Linux - Networking 4 11-25-2005 12:17 AM
Multiple RADIUS servers on a single machine skiros Linux - Software 3 11-02-2005 06:48 AM
Single Web Server Do I Really Need To Proxy ?? wylie1001 Linux - Networking 3 08-22-2004 08:27 PM
adding more web servers to make web server farm linuxboy69 Linux - Networking 5 07-09-2004 09:50 AM
Booting/running 300 servers from single image jjrowan Linux - Networking 2 01-02-2004 11:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration