35

I would like to use a domain name to point to a web page on the local server's IP address. However, the problem is that the page is linked to an IP address set up on port 8088 rather than 80 because the latter is already used by another web page. By the domain company I was told that they cannot do it because the domain can only point to an IP address set up on port 80. So now I am in a deadlock. What alternatives do I have and how can I make a domain pointing to the IP:8088?

Thanks

2
  • Do you control the web server that's handling port 80? What software is it?
    – Kenster
    Sep 22, 2014 at 11:27
  • Yes, I can control it. It is another web page which is set up on the same IP address but on port 80. However, as I said I want to use another page which is set up on the same IP address but using port 8088
    – george
    Sep 22, 2014 at 11:40

2 Answers 2

78

The domain company that you talked to may have done a poor job of explaining how domains work. Domain names don't refer to specific ports. They just refer to IP addresses. The client can look up a hostname to get the IP address which the client should connect to, but the client has to figure out the port without the help of DNS. Port 80 is just the default port for HTTP service.

You can certainly run a web server on port 8088 if you like. The port number would have to appear in the URL, e.g. http://somehost.example.com:8080/some/page. Clients would parse this and know to connect to port 8080 instead of the default port 80.

If you don't want URLs to contain the port number, then requests are going to go to the default port 80, and you have no choice but to make the web server running on port 80 handle these requests. HTTP/1.1 requests include the hostname which the client wants to contact, and modern web server programs are normally capable of serving completely different sets of content based on the hostname in the request. There are few ways todo what you need:

  1. Just configure the web server for port 80 to handle both sites. This will depend on what web server software you're using. Apache for example calls these "virtual hosts", and here is a set of examples. This is a typical solution, and some people run hundreds of sites on the same server this way.

  2. Run your two web servers as you planned. Set up the server for port 80 to be a reverse proxy for the second website. The server would continue to serve content for the site it handles now. When it receives a request for the second site, it would relay the request to the server running on port 8088, and relay the server's response back to the client.

  3. Move the existing server for port 80 to a different port. Run a pure reverse proxy server on port 80, relaying requests for both web sites to their respective web servers.

You might be better off taking further questions to https://webmasters.stackexchange.com/ or https://serverfault.com/.

3
  • 4
    Even tough this is from 2014, it just helped me to clear a lot out, thanks!
    – Advena
    Sep 24, 2018 at 21:13
  • Can I use second domain name as the ServerName , e.g. using www.example.com and other.example.com in the server configuration.
    – rosefun
    Dec 1, 2020 at 14:21
  • It would be great if they allow ip:port to A a domain name. sadly it is not possible today from my understanding.
    – zero8
    Jun 7, 2021 at 8:21
5

If you run Apache on port 80, which is the most common case then the easiest way to solve this issue is to set a VirtualHost that uses ProxyPass.

<VirtualHost sub.domain.com:80>   
  ProxyPass / https://ip-or-domain.com:8088/ 
</VirtualHost>

Not the answer you're looking for? Browse other questions tagged or ask your own question.