How do I host multiple public websites using IIS on the same EC2 Windows Server instance?

Last updated: 2021-02-03

I want to host multiple public websites using Internet Information Services (IIS) on a single Amazon Elastic Compute Cloud (Amazon EC2) Windows Server instance. How can I do that?

Resolution

If you have more than one website, you can host them in IIS on the same EC2 Windows Server instance. IIS differentiates between websites by using bindings, which are a combination of the protocol type, IP address, port, and hostname. To avoid IP and port conflicts, you must add a hostname.

Follow these steps to configure the IIS server on your instance to host multiple websites:

  1. If you haven't already done so, set up and configure your websites on the EC2 Windows Server instance. Make sure to install and configure IIS on the instance.
  2. Use the Amazon EC2 console to get the IP addresses of the EC2 Windows Server instance.
  3. Connect to the instance using Remote Desktop Protocol (RDP).
  4. Open IIS Manager, and in the Connections pane, choose the site that you want to add a host name to.
  5. In the Actions pane, choose Bindings, Edit, enter a name in the host name field, and then choose OK.
  6. Update the hosts file with the host name to access the website locally from the IIS server:
    Open a text editor using the Run as Administrator option, and then open the hosts file in the C:\Windows\System32\drivers\etc directory.
    Enter the Private IP address of the EC2 instance and the host name of your website, and then save the file.
  7. Repeat steps 4 through 6 for each additional website.

Now your websites can be accessed using the private IP address locally from the hosts file on the same EC2 Windows Server instance. For public access, add the public IP address in your public hosted zone through your DNS host provider or with Amazon Route 53.


Did this article help?


Do you need billing or technical support?