I have a Java Socket Listener at Port :5000
. And since i have an Public IP Address on my Server, it is available at something like this:
123.123.123.123:5000
It is fine.
But now, what if i don't want to use the IP Address, and instead use the Domain Name? How do i make my Domain Name to be applied on top of the IP Address please. I mean, to be something like:
www.example.com:5000
I have my DNS already pointing to Server. But I don't know how to apply (or) bind the Domain Name to a existing Port like that.
Please help to advise. I have very poor Networking Knowledge. Could it be done with NGINX or something?
Updated:
At somewhere, i've learnt it is something to do with Reverse Proxying
which can be done with NGINX. So i tried this:
server {
listen 5050 default_server;
server_name www.example.com;
location / {
proxy_pass http://123.123.123.123:5000;
}
}
As you could imagine, it is now working at:
http://www.example.com:5050
But: it still doesn't exactly solve my problem. Because i don't want another different port to be used (or) to be opening.
How do i use the exact same Port as my application is listening on (in this case is Port :5000
)?