Can we add multiple website on a single server?
Can we host multiple websites on same server? This is a question you have asked many times to yourself…Can’t able to find an answer! We will help you.
You are familiar with the term IIS that is Internet Information services. IIS is the third most popular web server in the world; behind Apache HTTP Server and nginx. IIS 6.0 has new features which are designed to help businesses, IT professionals, and Web administrators achieve their goals of performance, reliability, scalability, and security for potentially thousands of Web sites either on a single IIS server or on multiple servers. IIS supports multiple Web sites on a single server. For Rather than using three different servers to host three different Web sites, you can install all three Web sites on the same server. Consolidating the Web sites saves hardware resources, conserves space, and reduces energy costs.
While hosting multiple website on a single server you have to ensure that user requests reach the correct Web site; you must configure a unique identity for each site on the server. We can add as many as websites we need but the main issue we need to address is that those websites should to be uniquely identified within the IIS server. Otherwise the web server -IIS- will no be able to redirect the incoming http requests to the correct website. For that you must distinguish each Web site with at least one of three unique identifiers: a host header name, an IP address, or a unique TCP port number.
Hosting of multiple website on a single domain can be done using the following steps:
Step1: Add a Web site to the Web server.
Step 2: Edit the Web site binding and add a host header name, or create a new binding with a host header name.
Step 3: Add additional bindings with the same IP address and port number, but different host headers if you want to have additional sites assigned to one IP address.
To uniquely identify website you will use site binding to configure Http.sys to listen on IP addresses and ports. Site binding includes two main attributes which is the binding protocol and the binding information. The binding protocol is http this means that the communication between the client and the server will occur over the http protocol. And we can see the binding information which consists of: IP address, Port and host header.
As we stated above IIS is designed to host multiple websites by default each of them must be uniquely identified; so to carry out we need to play with binding information parts:
• IP address
• TCP Port
• Host Header
In IIS you can configure websites to listen to incoming http requests on all available IP address -unassigned- or on individual IP address. And by this you need to configure your website with certain IP address. Ok IIS> Sites> Add Web site and we need to fill the Site Name, Path, and in the binding information are type your certain website. Keep the other option as the same.
Custom TCP Port
What you need to do to accomplish this is the same of the previous step but you need to provide a unique and avail be TCP port. In the attached image the new site WebSite2 is using the same IP address of WebSite1 but on different port.
The process requires that the client send a Host: HTTP header as part of the HTTP request specifying a web site it wishes to access. And the web server having a web site configured with a corresponding HTTP Host: header value. Also Follow the same previous steps to define the website and fill the host header you need at the Host name field.
You can change the TCP port but this will make no sense since host headers will be enough to distinguish between websites on the same IP address. In fact One website can have multiple hosting headers you can add more host headers by adding more bindings with different host names. To edit the site bindings Choose the desired site > Edit Binding and you can add/edit/and remove bindings.
Clients could not be able to connect to the web server using host headers unless you those host headers are defined in the appropriate DNS Server or Host File. IIS is not a name resolution server it’s a web server. So the mechanism how the users can contact your web server with the names you choose; –host headers- is not the responsibility of the IIS server.