-1

I am trying to setup multiple website domains, but from different servers and because they are different servers they have different IPs, I am wondering if I could port forward each domain to 80, so far when I try port forwarding multiple IPs to port 80 I get an error that says Oops, 'local start port overlaps!' do I have to change options and settings on my router? or what?

2 Answers 2

4

It is not really clear to me what you are trying to accomplish but I think your setup is as follows:

  • You have a single public IP address (e.g. your home router)
  • You have several servers on the internal network, each hosting their own website
  • You want to forward the same port (TCP/80) to multiple servers.

I wonder why you want to host the website on different servers. You can configure Apache/nginx/... for virtual hosting, thus all websites with different domain names are hosted on the same server with the same IP address.

Another option is to forward all web traffic to a reverse proxy server, e.g. HAProxy. This machine will receive all traffic on port 80 and, based on the HTTP Host header, decide to which physical server to forward to traffic. That way you do host each website (domain) on a separate server.

5
  • the only problem with the first option is that, I don't really know how to setup a database server to hold all the content on. I'm very new to this, but the people on these sites hate new people because all they do is down vote every question I ask, I thank you for your answer though. I'll look into how to reverse proxy. Oh and would I reverse proxy on the server that I currently use for my web hosting and then connect all the other servers to it? Thanks
    – BadWo1f
    Dec 7, 2019 at 21:36
  • There is no database involved in the first option.
    – Tommiie
    Dec 7, 2019 at 23:41
  • I'm talking about when setting up the web server, I also have the database on it because I don't know how to directly connect a database server to a web hosting server, so I have it on the same machine
    – BadWo1f
    Dec 8, 2019 at 2:08
  • Setting up a database server is an entirely different question. “The people on these sites hate new people” is an untrue statement. But you need to ask the right questions and on the correct forums. I believe your question belongs on Super User (home users) and not here (businesses). Also, it seems like you would benefit from reading a few books om the topics of databases and web servers. I will try to find the time to update my answer later today.
    – Tommiie
    Dec 8, 2019 at 11:46
  • ok, p-lease let me know when you update it
    – BadWo1f
    Dec 9, 2019 at 0:24
1

You should learn how HTTP works:

  1. The web browser converts (resolves) the domain name to an IP address.
  2. The web browser connects to the IP address, usually on port 80 (cf. TPC/IP). Ports basically allow to connect to multiple services on the same IP (multiplexing).
  3. The web browser sends the URL he is interested in to the web server, including the domain name part.

Now, you have several problems to solve:

  1. Your servers probably are not on the Internet, your gateway is. There is an ugly hack going back 20-30 years that let you think they are: NAT. So you can forward you router's (only) port 80 to an internal host. There is also a proper solution, which is 20 years old, that can give every host a public IP: IPv6.
  2. A single program needs to serve the content of all domains. However this program can be a reverse proxy like nginx. A reverse proxy does not have (host) the content itself but contacts other web servers according to the URL in the request. These web servers can also have private IP addresses in the same network as the proxy.

Edit: In short you can not forward the same port to multiple hosts. Either use a single server or a reverse proxy.

5
  • dude, I just want the answer, please
    – BadWo1f
    Dec 7, 2019 at 6:39
  • No, you can not forward the same port to different machines. A solution is given above. Dec 7, 2019 at 6:41
  • can you please explain the solution? all you really told me are the problems. oh and how do hosting companies host so many domains then?
    – BadWo1f
    Dec 7, 2019 at 6:45
  • I know that port 431 is an open port but it is https... could I use that? would I have to do anything else to the domain if I use it?
    – BadWo1f
    Dec 7, 2019 at 6:49
  • I edited the answer. Dec 7, 2019 at 7:17

Not the answer you're looking for? Browse other questions tagged .