简体   繁体   中英

How to open a website by entering its name, not the IP address of the server

I have created a website and set it up on IIS on a Windows Server 2008 R2 which is on the local network. What should I do to be able to access that website by typing its name in the browser from client machine? Right now there're only two sites: One is the Default Website and the other one is my newly created one. If I type this IP in the browser of a remote computer, which has access to the server, the default website opens. If I add https:// to the ip address I get directed to my website. This means the website opened is decided upon the protocol (http or https). What if I add another website that would require SSL?

Actually the site you browse to is not decided by the protocol, it's decided by the port. By default HTTPS is port 443, and HTTP is port 80. So if you have an HTTPS and HTTP protocol added to a website in IIS, you've created bindings for these two ports automatically.

This is visible by going into IIS clicking "Sites" from the "Connections" section in the left pane and then looking at the "Bindings" column in the center pane.

If you create another website on the host which uses SSL you would have to assign it to a different port.

To browse to that new SSL website you would have to enter the port when browsing to it.

eg https://serverName:444

(You don't have to enter default ports, 80 & 443, your browser automatically infers which to use from the protocol type and adds them if no other is present)

This is inconvient for users so people get around this by registering domain names such as stackoverflow.com and pointing them to the address with the port eg https://stackoverflow.com:444 , so users don't have to enter port numbers.

Have you added the website address to the host file which sits in the drives folder of the system32. If you add the website name against the IP in the host file you should be able to access it using the name rather than than IP address

Something like this- 10.18.20.108 test.stackoverflow.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM