Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
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 :-)
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.
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"!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.