Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to give a domain name to the IP address and port for an application in Windows 7. For example, test.com should map to 127.0.0.1:59873.

Is there anyway that we can do it by using a web server or DNS server?

share|improve this question
    
You are trying to do something that doesn't make any sense. What's your actual problem? What are you trying to make happen? –  David Schwartz Feb 25 '12 at 23:54
    
I am using one application which is running on 127.0.0.1:5986.I want use this address in different application but this application doesn't accept ":" in 127.0.0.1:5986.So I want to create an name with the ip and port. –  sandeep.malladi Feb 26 '12 at 0:12
    
Unfortunately there is no known/easy way to make an alias for an IP/port pair. The closest you can come is making an alias for an IP address with the HOSTS file. :-( –  Synetech Feb 26 '12 at 0:18
    
Use 127.0.0.2:5986 if you can't specify a port. –  David Schwartz Feb 26 '12 at 0:19
1  
@ta.speot.is, fine; drop the “known” from my comment and leave the “easy”. –  Synetech Feb 26 '12 at 0:37

1 Answer 1

nginx can be run as a reverse proxy, suitable for doing this. If you do everything right, you'll end up with something like the below (minus the "remote" part - since this will all be on one machine):

enter image description here

  • Navigator is your machine
  • Reverse Proxy is nginx running on your machine (127.0.0.1:80)
  • Remote Server is the web site running on your machine (127.0.0.1:59873)

Configure nginx to reverse proxy test.com to 127.0.0.1:59873 and then add the following entry to your HOSTS file:

127.0.0.1 test.com
share|improve this answer
    
looks impressive. Out of interest, why is that called reverse proxy? a proxy is a middle man.. what is the reverse aspect? –  barlop Feb 26 '12 at 1:59
    
@barlop what we used to call just "proxy" or proxy server normally sits close to the client, or in the client infrastracture and it is just used by a set of clients to access multiple content. A reverse proxy works close to the server, any client that want to access that content will reach first the reverse proxy. –  José F. Romaniello Mar 27 '12 at 17:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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