简体   繁体   中英

Can server host different domain in same port?

I am trying to understand how to host different apps in server, so can server host different domain in same port. For example, I have domain1 and domain2 both hosted at port 443. Can this be done?

I am doing this in IIS server.

A single web IIS server can host different domain in same port. However, in order IIS to distribute HTTP requests correctly, each website has to be identified with some unique value. In case of an IIS website, it consists of three attributes that make up a unique combination for each website. These are:

  • a TCP port number
  • an IP address
  • a host header (host name)

The information about the hosted websites is stored in the ServerBindings attribute of the IIS metabase in the following format: IP:Port:Hostname. Thus, if you want to host multiple websites on the same port and IP address, you will have to use a unique Host header. What is it? Host header is a part of an HTTP request to the server sent by a client that specifies which website it is addressed to. Accordingly, this host header must be specified on the side of the web server, and the DNS contains the correct record that matches the hostname and the IP address of the IIS web server.

Let's suppose that you have a website running on IIS and listening 443 port. And you need to bind second website to the same port. In the IIS Manager, create another website with the name TestSite, which files will be located in c:\\inetpub\\TestSite (do not specify the hostname yet). After you click OK, a warning appears that you cannot use the binding *:443 for both sites.

The binding '*:443:' is assigned to another site. If you assign the same binding to this site, you will only be able to start one of the sites. Are you sure that you want to add this duplicate binding?

Agree to this warning. So you have got another site bound to port 443, you cannot start it without stopping the first site.

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