Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I host two separate web servers on a LAN to the outside world through 1 IP address?

I am a web programmer with a home web dev operation. I have multiple web servers in my house on a FIOS connection. I have my own domain pointed to my router through dyndns.org's custom domain service.

My ISP gives me ONE static IP address, which at the moment allows me to configure my router to direct outbound web traffic from one server through port 80 and another server through port 8080. This sucks because many companies block port 8080 these days causing some of my corporate clients to not be able to hit my second web server.

Is there any way for me to direct regular old port 80 web traffic to TWO SEPARATE web servers internally on my network using two separate host names?

For instance. I want http://webserver1.mydomain.com to hit one web server on my network, and http://webserver2.mydomain.com to hit another web server and have both sets of traffic served on port 80.

Is this even possible? If not, can I do a hack by programmatically routing traffic from one web server transparently to another?

For the record I run MS Windows Server 2008 IIS 7.0 stack, a D-link DIR-655 router, and use DynDNS for my domain needs.

like image 489
Matias Nino Avatar asked Jan 16 '09 06:01

Matias Nino


People also ask

Can you have 2 servers on the same IP?

Answer: Yes. Two virtual servers on the same Application Switch or Web Switch can share the same virtual IP address as long as they are each configured with unique services or with different source networks.

Why should another computer on the same network LAN not be assigned the same IP address?

So what's going on? For a system to communicate via a network, it must have a unique IP address. Conflicts arise when two devices are on the same network trying to use the same IP address. When this occurs, both computers cannot connect to network resources or perform other network operations.

Can a Web server have multiple IP addresses?

Sometimes people run dns servers on the same machine as their web server. In this case, you need two ip addresses for two different name servers in order to comply with RFCs.

Can I run two web servers on the same computer?

You can run two different servers on the same localhost via different port numbers or two different localhosts on the same port (localhost ranges 127.0. 0.0 - 127.255.


1 Answers

The name of the solution you looking for is called reverse proxy'ing.
There are implementations in apache, squid and Mircosoft ISA Server.

If your adventurous you can always roll your own? or modify something like this to meet your your needs.

I've had customers using squid reverse proxy that's high volume and it works perfectly!

It does tend to screw up your web logs on the webserver though, traffic will all appear to come from your internal proxy host that's doing the redirection/rewriting.

like image 188
Nick Kavadias Avatar answered Oct 04 '22 03:10

Nick Kavadias