Norwelian
Norwelian

Reputation: 67

Configure domain to send traffic to a specific port

I'm planning on buying two domains.
Let's say they are domain1.com and domain2.com.
I will point them at two custom servers that I have on my computer, both of them having an HTML "browsable" endpoint.
I want to know if it's possible to point domain1.com to mycomputer:12345 and domain2.com to mycomputer:9876, so when you open, for example, domain2.com with your browser, it redirects the traffic to mycomputer:9876, without writing explicitly domain2.com:9876.
I've been searching for information about DNS records and reverse proxies, but I'm unable to figure out a way to achieve this, or something close to it.
Thanks for your time.

Upvotes: 0

Views: 181

Answers (1)

mdeora
mdeora

Reputation: 4534

You can achieve this by using a reverse proxy server eg. nginx.

All you need to do is configure each domain to to the appropriate server and port in the nginx config.

Just for your information - At DNS level you can't mention ports, as DNS servers doesn't carry port information.

Upvotes: 1

Related Questions