×
Community Blog Build Multiple Websites on a Windows ECS Instance

Build Multiple Websites on a Windows ECS Instance

This article describes how to use Internet Information Services (IIS) to build multiple websites on a Windows Elastic Compute Service (ECS) instance.

By Alibaba Cloud ECS Team

This article describes how to use Internet Information Services (IIS) to build multiple websites on a Windows Elastic Compute Service (ECS) instance. In this article, the instance runs Windows Server 2012 R2 64-bit.

Prerequisites

  • An Alibaba Cloud account is created. To create an Alibaba Cloud account, go to the account registration page.
  • An instance is created, and the web environment that consists of IIS, PHP, and MySQL is deployed on the instance. You can use a Windows image from Alibaba Cloud Marketplace that is installed with the environment to deploy the environment.

Background Information

This tutorial is intended for users who are familiar with Windows and want to optimize the O&M process by making efficient use of resources and managing sites in a centralized manner. For example, you can configure multiple blogging platforms of different categories or build multiple websites to handle complex business tasks on an instance.

In this tutorial, IIS is used to simultaneously build the windows-testpage-1 and windows-testpage-2 websites and configure different domain names on the same port to access the websites.

In this article, the following instance configurations are used:

  • Instance type: ecs.c6.large
  • Operating system: Windows Server 2012 R2 64-bit

Create Test Websites

1.  Connect to the instance on which the web environment is deployed. For more information, see Connect to a Windows instance by using password authentication.

2.  On the desktop, click This PC and go to the C:wwwroot path in the default root directory.

3.  Create the windows-testpage-1 and windows-testpage-2 folders.

1

4.  Open the windows-testpage-1 folder, create the test1.php file in the folder, and then enter the following content in the file:

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

5.  Open the windows-testpage-2 folder, create the test2.php file in the folder, and then enter the following content in the file:

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

Configure IIS

1.  In the taskbar, click the Server Manager iconserver 2.

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

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

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

The following figure shows how to configure the website.

3

The following list describes how to configure the parameters:

  • Site name: Enter windows-testpage-1.
  • Application pool: Select DefaultAppPool.
  • Physical path: Select a physical path for the windows-testpage-1 website.
  • Host name: Specify the test1.com domain name as the hostname.

5.  In the Actions section on the right, click Add Website. Add the windows-testpage-2 website and click OK.

The following figure shows how to configure the website.

4

The following list describes how to configure the parameters:

  • Site name: Enter windows-testpage-2.
  • Application pool: Select DefaultAppPool.
  • Physical path: Select a physical path for the windows-testpage-2 website.
  • Host name: Specify the test2.com domain name as the hostname.

The following figure indicates that the websites are added.

5

(Optional) Configure the hosts file on the local host

In this tutorial, the domain names are used only for test purposes. You must configure IP mapping in the local hosts file. If you use the actual server domain names when you configure the websites, skip this step. In this tutorial, the local physical server uses the Windows operating system.

1.  Go to the C:WindowsSystem32driversetc directory.

2.  Copy the hosts file for backup.

Retain the hosts - copy file, which can be used to restore the hosts file to the initial state after the test is complete.

3.  Modify the hosts file.

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

<Public IP address of the instance> test1.com
<Public IP address of the instance> test2.com

4.  Go back 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 line to make the configurations of the hosts file immediately take effect:

ipconfig /flushdns

Result

You can access the two test websites from a browser on the local host.

  • Enter test1.com/test1.php in the address bar of the browser and press the Enter key. The windows-testpage-1 website is displayed, as shown in the following figure.

6

  • Enter test2.com/test2.php in the address bar of the browser and press the Enter key. The windows-testpage-2 website is displayed, as shown in the following figure.

7

Multiple websites are built. In your actual operations, you need only to make sure that the hostnames and project paths are correctly configured to access your websites. You can install SSL certificates in IIS. For more information, see Install SSL certificates on IIS servers.

0 1 0
Share on

Alibaba Cloud Community

1,026 posts | 251 followers

You may also like

Comments

Alibaba Cloud Community

1,026 posts | 251 followers

Related Products