Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Other than specifying the host name in the host file for web site are there other steps needed to be able to refer to the site by that name instead of the ip address? I want to access the site like this

http://mypages/page.php

instead of

http://localhost:82/page.php 

or

http://192.x.x.x:82/page.php

I only need this on a Windows 7 computer accessible only on a home network. The site doesn't need to be accessible from the web. I thought if I just added an entry to the host file like this 192.x.x.x:82 mypages that this would sufficient. But this was not. Seems to make sense that this could be the way to specify a name for that ip address. What are the proper steps?

Someone talked about dns configuration. I found a lot of technical definitions on google but so far no practical step by step instructions. I have a windows 7 pc with iis. Is there software I must install? where do I get it? What are the steps for resolving the name of that web site?

Thanks.

share|improve this question

3 Answers 3

You can't specify a port number for a service in DNS or the HOSTS file. Your hosts entry should say

192.x.x.x mypage.com

After that, you'll be able to connect via http://mypage.com:82/page.php

If you want to get rid of that ugly :82 in the URL, make the webserver on the local machine run on port 80.

share|improve this answer

Adding host/domain name to hosts file is just first step. I usually use 127.0.0.1 IP if it only accessible from your own computer: 127.0.0.1 mypages.dev.

The last step that you still may be missing is to add host header into site config, so IIS knows which site to refer to. In IIS Manager:

  • select site
  • click on "Bindings"
  • click "Add..."
  • IP Address: All unassigned; Port: 80; Host Name: mypages.dev

Now you can refer to it via http://mypages.dev/.

P.S. I like to add .dev tld -- it looks more natural/real that just mypages.

share|improve this answer

As others have stated (which I missed in your original question), you have to specify the port in the URL in your browser because you're running the web site on port 82 instead of port 80. As MarkM stated, if you want to get to the site simply by browsing to http://mypages then you need to bind the web site to port 80 on the web server. If you want to bind multiple web sites to port 80 then you need to configure the appropriare host headers for each site so that IIS can differentiate between them when requests come in to the server.

share|improve this answer

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.