-1

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.

user823527
  • 107
  • 2

3 Answers3

1

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.

MDMarra
  • 100,734
  • 32
  • 197
  • 329
0

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.

LazyOne
  • 3,064
  • 1
  • 18
  • 16
0

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.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172