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?
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:
- 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.
- Use the Amazon EC2 console to get the IP addresses of the EC2 Windows Server instance.
- Connect to the instance using Remote Desktop Protocol (RDP).
- Open IIS Manager, and in the Connections pane, choose the site that you want to add a host name to.
- In the Actions pane, choose Bindings, Edit, enter a name in the host name field, and then choose OK.
- 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.
- 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.