2

I am new in Ubuntu. I have created my website in node. where I am using different port for different modules.

like http://localhost:5555/ this is for admin,

http://localhost:5050/ this is for client access.'

I am using Digitalocean ubuntu server and I have bought domains from Godaddy.

I want to set different domain on different port.

like

http://localhost:5555/ should be "http://admin.example.com".

http://localhost:5050/ should be "http://example.com".

I have tried with nginx but doesn't get any useful.

Please help me . Thanks in advance.

1

The issue here is that different domains cannot automatically go to different ports. You'd have to type http://admin.example.com:5555, since your browser will automatically try to use port 80. There are some DNS configurations that will decide which website to serve up based on domain name, but they expect you to use port 80 for all of them. If you're using different ports for security reasons, then you really can't bypass that.

0

As Daniel said, you really can't use DNS (domain names) to specify a port; you'd have to have different external IP addresses and then use port mapping on your router to redirect them to different ports.

The much better solution, if you're running the web sites on the same machine -- esp. if you're not using SSL (https using older browsers didn't support this) is to configure your web server (good ones do support this) for multiple virtual hosts based on the URL running on the same port. Then you can drop the whole custom port thing (or use the same port# if you have a need not to use 80) and it's a lot easier.

This page introduces you to name-based virtual hosting on Apache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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