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

2 minute read
0

I want to use Internet Information Services (IIS) to host multiple websites on a single Amazon Elastic Compute Cloud (Amazon EC2) Windows Server instance.

Resolution

If you have multiple public websites, then you can host them in IIS on the same EC2 Windows Server instance. IIS uses bindings to differentiate between websites. Bindings are a combination of the protocol type, IP address, port, and hostname. To avoid IP address and port conflicts, you must add a hostname.

To configure the IIS server on your instance to host multiple websites, follow these steps:

  1. Set up your websites on the EC2 Windows Server instance. Make sure to install and configure IIS (from the Microsoft website) on the instance.
  2. Use the Amazon EC2 console to get the IP addresses of the EC2 Windows Server instance.
  3. Use Remote Desktop Protocol to connect to the instance.
  4. Open IIS Manager. In the Connections pane, choose the site that you want to add a hostname to.
  5. In the Actions pane, complete the following steps:
    Choose Bindings.
    Choose Edit.
    In the hostname field, enter a name.
    Choose OK.
  6. Update the hosts file with the hostname to access the website locally from the IIS server:
    Open a text editor with 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 hostname of your website, and then save the file.
  7. Repeat steps 4 through 6 for each additional website.

To access your websites, use the private IP address locally from the hosts file on the same EC2 Windows Server instance. For public access, use your DNS host provider or Amazon Route 53 to add the public IP address in your public hosted zone.

AWS OFFICIAL
AWS OFFICIALUpdated a year ago