All Products
Search
Document Center

Elastic Compute Service:Configure multiple websites with IIS

Last Updated:Jul 15, 2026

Hosting multiple websites on a single ECS instance reduces operational costs and simplifies management tasks, such as software updates, security configurations, and data backups. It also lets you flexibly allocate resources based on each website's needs. This topic describes how to use Internet Information Services (IIS) to host multiple websites on an ECS instance that runs Windows Server 2012 R2 64-bit.

Prerequisites

You have created an ECS instance and deployed an environment with IIS, PHP, and MySQL. You can find a suitable Windows web environment image in the Alibaba Cloud Marketplace to quickly set up your environment.

In this tutorial, you will use IIS on Windows to build two test websites, windows-testpage-1 and windows-testpage-2. You will configure them to be accessible through different domain names on the same port.

Create the test websites

  1. Establish a remote connection to the ECS instance where the web environment is deployed.

  2. On the desktop, click This PC and navigate to the default website root directory at C:\wwwroot.

  3. Create two folders named windows-testpage-1 and windows-testpage-2.

    The folder is located in the C:\wwwroot directory.

  4. In the windows-testpage-1 folder, create a test file named test1.php with the following content.

    <?php
    echo "<title>Test-1</title>";
    echo "windows-test-1";
    ?>
  5. In the windows-testpage-2 folder, create a test file named test2.php with the following content.

    <?php
    echo "<title>Test-2</title>";
    echo "windows-test-2";
    ?>

Configure the IIS server

  1. On the taskbar, click the Server Manager icon server.

  2. In the top menu bar, click Tools > Internet Information Services (IIS) Manager.

  3. In the navigation pane on the left of IIS Manager, click the server name, and then click Sites.

  4. In the Actions pane on the right, click Add Website.... Add the windows-testpage-1 test website, and then click OK.

    The website is configured as follows:

    Parameters:

    • Site name: Enter windows-testpage-1.

    • Application pool: DefaultAppPool

    • Physical path: Specify the physical path to the windows-testpage-1 folder.

    • Host name: Enter the test domain name test1.com.

  5. In the Actions pane, click Add Website... again. Add the windows-testpage-2 test website, and then click OK.

    The website is configured as follows: In the Bindings section, set Type to http, keep IP address as All Unassigned, set Port to 80, and select Start Website Immediately.

    Parameters:

    • Site name: Enter windows-testpage-2.

    • Application pool: DefaultAppPool

    • Physical path: Specify the physical path to the windows-testpage-2 folder.

    • Host name: Enter the test domain name test2.com.

    After the websites are added, the IIS website list shows three websites (default.com, windows-testpage-1, windows-testpage-2), all in the Started state, bound to domains default.com, test1.com, and test2.com, with port 80 for each.

(Optional) Configure the local hosts file

Because this tutorial uses test domain names, you need to configure IP address mapping in the hosts file on your on-premises host. If you are using real domain names to configure your websites, you can skip this step. This tutorial assumes your on-premises host runs Windows.

  1. Navigate to the C:\Windows\System32\drivers\etc directory.

  2. Create a backup of the hosts file.

    Keep the hosts - copy file to restore the original hosts file after testing.

  3. Modify the hosts file.

    Append the following lines to the end of the file. Then, save and close the file.

    <The public IP address of your ECS instance> test1.com
    <The public IP address of your ECS instance> test2.com
  4. Return to the Windows desktop and press Win + R.

  5. In the Run dialog box, enter cmd and click OK.

  6. Run the following command in the command prompt to apply the changes immediately.

    ipconfig /flushdns

Verify the results

On your on-premises host, open a web browser to verify that you can access both test websites.

  • Go to test1.com/test1.php. The page returns windows-test-1, indicating that the first test website is running normally.

  • Go to test2.com/test2.php. The page displays windows-test-2, indicating that the second virtual host website is configured correctly.

You have successfully hosted multiple websites. In a real-world scenario, you only need to correctly configure the host name and the physical path for each project to make your websites accessible. If you need to install an SSL certificate, see Install an SSL certificate on an IIS server (Windows).

References

If you want to host multiple websites on a Linux instance, see Configure multiple websites by using the Nginx service.