Subdomains pointing to same droplet in different ports?

Hi, we would like to have 3 subdomains resolving to the same IP (same droplet) but pointing to 3 different servers that will be running on it.

The servers were developed in GO programming language (golang).

One domain will be the API serving on port X:

Other one will be our Admin Dashboard on port Y:

And the last one will be our website running probably on port Z:

How can we config the DNS to accomplish our desired setup? Can you help us with that?

Thank you very much in advance.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Firstly, create a DNS record for each of the subdomains. The DNS records tell the browser which server/IP address it should connect to. Browsers assume port 80 by default. <br> <br>In order to map each subdomain to a different port, you will need to use a reverse proxy such as nginx. <a href=“”></a>. <br> <br>You will need to insert <a href=“”>this</a> into each virtualhost instead of the virtualhost config in the said article.