Give a name to localhost with specifying a port [closed]

You can't, you have to expressly state the changed port at the client end.

DNS is purely for IP resolution, it doesn't deal with port numbers at all, that's a client-side assumption that's built into your various client applications.

So for instance you'd use your browser to point to example.com:8090 - there's no other way for the client to know that you've changed the port.

By the way, please read our FAQ, this site's for professional sysadmins, be aware of our sister site superuser.com which is perhaps more appropriate for very basic general questions such as this.


You can't.

If you don't provide a port number in your web browser, it'll automatically use the well-known ports for HTTP (80/tcp) or HTTPS (443/tcp), depending on the URI you've entered.

If you don't use the well-known ports for your web server you'll have to enter them explicitly.