LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-08-2011, 04:24 PM   #1
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
HTTP dispatching based on domain


Hey GUYS,

I have a small problem (with a possible solution), but I'm interested in your opinion/experience if you would do it similar or if you probably know better/easier tools to achieve this.

The problem: I have a single server (gateway) and two virtual machines. Each virtual machine has a separate private IP address and runs a web-server, while each web server should service a distinct web domain, say domain1.net and domain2.net. The gateway server uses iptables rules to forward tcp packets to the appropriate virtual machine, e.g. based on the destination port number. Now, since I want the users of the web domains to NOT use a port different than 80, I am looking for some kind of HTTP dispatching based on the domain requested by the user, though domain1.net:80 should be forwarded to VM1 and domain2.net:80 should be forwarded to VM2.

I think there are a few solutions to this problem:

(1) consolidate to one VM, put both domains on the same web server and use e.g. apaches virtual host functionality -> right, but want to keep the two virtual machines ;-)

(2) add the mod_rewrite plugin to one of the web servers and configure it to do the rewriting -> haven't yet tested it, but could work

(3) put a proxy server (though SQUID) onto the gateway server and use the rewrite functionality of SQUID to redirect the packets to the appropriate virtual machine

My favorite solution is #3, but I am very interested in your experiences with similar problems or how you would solve this before I start diving into SQUID.

Maybe I'm also overseeing the very trivial solution :-)

Thanks for your help,
Andi
 
Old 03-09-2011, 12:21 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

If you want to keep both VMs running their own webserver, then go for the reverse proxy scenario (solution 3).
Just a note: Apart from squid, you can also use apache or nginx as a reverse proxy on the gateway.

Regards
 
1 members found this post helpful.
Old 03-09-2011, 01:26 AM   #3
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Original Poster
Rep: Reputation: 67
Quote:
Originally Posted by bathory View Post
If you want to keep both VMs running their own webserver, then go for the reverse proxy scenario (solution 3).
Just a note: Apart from squid, you can also use apache or nginx as a reverse proxy on the gateway.
Thanks for your answer and your recommendations. And thanks for telling the right expression. I didn't yet know that this scenario is called "reverse proxy"!

Andi
 
  


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
http://xx.xx.xx.xx redirecting to the domain name - I don't want it.. utnalove Linux - Server 1 08-29-2009 10:54 AM
DNS http:domain.com resolve to www.domain.com keysorsoze Linux - Networking 3 02-12-2007 03:03 AM
forward IP based on http IP header freibuis Linux - Security 7 08-24-2004 12:21 AM
Log dispatching? dee3lmo Linux - Newbie 0 07-12-2004 12:34 PM
mandrake 8.0 http domain faults navyet2sw Linux - General 0 09-21-2001 12:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:38 PM.

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