How does one specify a different domain name for the localhost domain on an IIS server? I am setting up an IIS on a pc. I want a more user friendly name. The server will not be accessible to the outside world. It will only be on a home network. I shouldn't have to buy a domain name to do that. This is all new to me, so I am looking for information about how to specify that user friendly name, e.g. http://mypages/file.php instead of http://localhost:82/file.php
3 Answers
Configure host headers on the site for whatever name you want to connect to it as. You'll also need some type of name resolution mechanism (DNS, Hosts file) that will resolve the name to the correct ip address.
-
Note: a host header is not necessary unless IIS is running a different site on port 80. Otherwise this site only needs to accept connection on port 82 regardless of the host header– uSlackrAug 9, 2011 at 20:29
-
True. I didn't read the question carefully enough. Thanks for catching that. Aug 9, 2011 at 20:32
You are describing a DNS setup. There are a couple steps to this. First, you need to know the IP address of the PC. Once you have that address in hand, you need to configure DNS to translate the name you want to use into the address of the PC.
Often times, your home PCs are pointing to the router for DNS resolution. If so, and your router supports it, add a DNS entry for mypages that points to the PC address.
If you cannot configure DNS, then it's a bit trickier. You could run your own DNS (not trivial) or you could update the host file on your PCs to translate the address for you.
Once you have DNS set up, you can access the site as http://mypages:82. If you want to remove the :82, then you'll need to configure it (look at the IIS site properties and click the advanced button next to IP address) to add port 82. You will ned a host header entry if IIS is running a separate site on port 80.
-
Googling configuring DNS turned up a lot of technical information without a lot of practical step by step instructions. How do I do that. I finally found information about editing the host file. 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? Aug 9, 2011 at 23:28 -
Your entry is correct except remove the :82. That is not part of the IP address which is all this fixes. Make sure there is no leading # on the line. to see if it is working, try pinging mypages ('ping mypages' from a command shell). It should resolve the name to the address even if the ping fails.– uSlackrAug 10, 2011 at 13:28
Found this answer to specify a name for my website.
- Right-click Notepad and Run as Administrator.
- Open "hosts" file from c:\Windows\System32\drivers\etc.
Add one line to specify a hostname for the pc like this.
192.62.1.1 Fastpc
With this you should be able to access the root for the IIS server from you browser by typing in the address the following.
http://Fastpc/
If you have several sites from the root site, you can add their directory name to that address, e.g.
http://Fastpc/demo/page.php