Updated on 2025-08-06 GMT+08:00

Setting Up Multiple Websites Using IIS

You can set up multiple websites on an ECS to reduce operating costs and manage multiple websites (including updating software, security settings, and backing up data) conveniently. You can flexibly adjust resource allocation based on the requirements of each website. This section describes how to use the IIS service to set up multiple websites on an ECS running Windows Server 2022 Standard 64-bit.

Prerequisites

Creating Test Websites

Set up two test websites page-one and page-two on an IIS server running Windows and configure different domain names for the same port to achieve website access.

  1. Remotely connect to the ECS where the web environment has been deployed.

    For details, see Login Overview (Windows).

  2. Click the start icon in the lower left corner of the desktop and go to the root directory C:\web of the default website.
  3. Create the page-one and page-two folders.

  4. Go to the page-one folder, create the test file index.html, and add the following content to the file:
    test page one
  5. Go to the page-two folder, create the test file index.html, and add the following content to the file:
    test page two

Configuring the IIS Server

  1. On the taskbar at the bottom of the desktop, click the server manager icon .
  2. On the top menu bar, choose Tools > Internet Information Services (IIS) Manager.
  3. In the navigation pane of the IIS Manager, double-click the server name and then double-click Sites.
  4. In the right pane, click Add Website...
  5. Add the windows-page-one test website and click OK.

    The following figure shows the parameters for configuring the website.

    The parameters for configuring the website are described as follows:

    • Site name: windows-page-one
    • Application pool: windows-page-one
    • Physical path: physical path of the test website page-one
    • Host name: windows1.com
  6. In the right pane, click Add Website...
  7. Add the page-two test website and click OK.

    The following figure shows the parameters for configuring the website.

    The parameters for configuring the website are described as follows:

    • Site name: windows-page-two
    • Application pool: windows-page-two
    • Physical path: physical path of the page-two test site
    • Host name: windows2.com

    After websites are added, the following page is displayed.

(Optional) Configuring the hosts File on the Local PC

If you use test domain names when configuring multiple websites, you need to configure the IP address mapping in the hosts file on the local PC. If you use real domain names, skip this step. In this tutorial, the local physical machine runs the Windows OS.

  1. Access the C:\Windows\System32\drivers\etc directory.
  2. Copy the hosts file for backup.

    Retain the hosts - Copy file and use it to restore the hosts file after the test is complete.

  3. Modify the hosts file.

    Add the following content to the end of the file, save the file, and exit:

    <ECS instance public IP address> windows1.com
    <ECS instance public IP address> windows2.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 CLI to apply the changes to the hosts file immediately:
    ipconfig /flushdns

Verification

  • Access windows1.com and view the content of the page-one site.

  • Access windows2.com and view the content of the page-two site.

The websites have been set up. In actual website setup scenarios, you only need to configure the correct host name and physical path to achieve multi-website access.