I want to host multiple public websites on a single Amazon EC2 Windows Server instance. How can I do this?
You can configure this with Internet Information Services (IIS) using multiple host names on an EC2 Windows Server instance.
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 host name. To avoid IP and port conflicts, you must add a host name.
- Open the Amazon EC2 console, select your instance, choose the Description tab, and then take note of the Public IP address (internet access) and Private IP address (local access). For additional information, see Working with IP Addresses for Your Instance.
- Connect to your instance using RDP. Be sure that you have IIS installed and configured on the instance. For instructions about installing IIS, see Installing a WIMP Server on an Amazon EC2 Instance Running Windows Server.
Note: If you haven't already done so, set up and configure your first website. For additional information, see How do I publicly host my website on an EC2 Windows instance using IIS?
Add a host name using IIS Manager and update your local hosts file:
1. Open IIS Manager, and in the Connections pane, choose the site that you want to add a host name to.
2. In the Actions pane, choose Bindings, Edit, enter a name in the host name field, and then choose OK.
3. 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.
4. Repeat steps 1-3 for each additional website.
Now multiple 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 web provider or with Amazon Route 53.