tcak
tcak

Reputation: 2212

How does home network hosting work?

I have a router in home. 3 different computers are connected to that router. Each computer has its own Apache software and has been set up to publish a webpage.

Router has only 1 IP address to outside. Lets say it is 88.65.1.7. All computers have different IP addresses like 192.168.0.1, 192.168.0.2, 192.168.0.3.

I want to use 3 different domain names. www.a.com www.b.com www.c.com

If I ping to www.a.com, or www.b.com, or www.c.com, all domains go to same 88.65.1.7 IP address. Because all of them are behind of same router.

What I can't understand is that how the network system can understand to go 192.168.0.1 when I type www.a.com to browser, and 192.168.0.2 when I type www.b.com, blah?

Or maybe I am thinking some things wrong.

Upvotes: 0

Views: 110

Answers (1)

Nate
Nate

Reputation: 12829

One solution would be to set up port forwarding from the router to one machine, the 'main' machine, in whose apache httpd.conf you use rewrite rules to redirect the traffic, as so, assuming that your a.com machine is your main machine:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.b\.com
RewriteRule (.*) http://192.168.0.2:80$1 [P]
ProxyPassReverse / http://192.168.0.2:80/

This would funnel traffic for b.com through the machine for a.com.

Upvotes: 1

Related Questions