-1

I am using xammp on windows. I change my port number as 8090 but now I couldnt reach the localhost when I type example.com to the browser. What should I do to make any name to open my localhost even if the port is not 80. Or moreover I

127.0.0.1 example.com

Thank in advance,

joschi
  • 21,387
  • 3
  • 47
  • 50

3 Answers3

4

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.

Chopper3
  • 101,299
  • 9
  • 108
  • 239
  • 2
    "DNS is purely for IP resolution, it doesn't deal with port numbers at all" -- at the risk of confusing the OP, I feel obligated to mention SRV records... – womble Aug 14 '11 at 09:43
  • Great point but I'm assuming he's moved his apache port and right now SRV is kind of limited by use (SIP/LDAP etc.) – Chopper3 Aug 14 '11 at 11:10
  • 1
    I wouldn't want anyone who comes across this answer in the future to get the wrong idea. – womble Aug 14 '11 at 21:10
2

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.

joschi
  • 21,387
  • 3
  • 47
  • 50
0

It is absolutely unclear what you are asking!

If you set your Apache to listen on 8090 then it listens on that port (and probably not on any other). So you have to put http://127.0.0.1:8090/ or http://localhost:8090 in your webbrowser.

When you now put a line as

127.0.0.1 localhost example.com

in your hosts file, then you can reach your site with http://example.com:8090/, too.

But you always have to specify the port. Otherwise it won't work!

mailq
  • 17,023
  • 2
  • 37
  • 69