How do I route web requests into my private network depending on the domain in the url?
Most routers/firewalls allow to redirect traffic based on a certain port, e.g. all SMTP traffic (port 25) is redirected to 192.168.1.1.
But if you have multiple servers to handle your traffic (1 server per domain). You need to install something like a reverse proxy (nginx supports this for HTTP, IMAP, POP3).
For instance, all traffic to port 80 is redirected to 192.168.1.2
which runs nginx and depending on the host name will redirect to either localhost
or 192.168.1.4
.
Related videos on Youtube
Comments
-
Matthew Ruston over 1 year
Scenario:
Due to limited number of IPs, several domains are resolved into the same IP address. However, these domains may not all run on the same webserver, VM, or even dedicated machine. Therefore, I would like to route the domains at the point of entry into the private network to the right place on condition of the domain in the url.
How can I do this?
-
Matthew Ruston over 13 yearsI used to have troubles with mod_proxy, but I might try this again.
-
Matthew Ruston over 13 yearsI don't think I can use rewrite to the ip-address since this would prevent me to use multiple domains in one VM, however, I probably can rewrite into local sub domains.
-
Jeff Winkworth over 13 years+1 Nginx is perfect for this as it doesn't use much memory and was designed to handle large numbers of requests. It's pretty easy to setup on most distros.
-
Scott Anderson over 13 years+1 Apache is definitely overkill. A simple Nginx proxy will get the job done.
-
Matthew Ruston over 13 yearsI have installed nginx. It was very easy to install and configure and works very good.