An LNMP environment is based on four major components required in this architecture: Linux, NGINX, MySQL, and PHP. This topic describes how to use Alibaba Cloud Resource Orchestration Service (ROS) to efficiently deploy the LNMP environment.

Prerequisites

You must have an Alibaba Cloud account before you follow the instructions provided in the tutorial. To create an Alibaba Cloud account, click Create an Alibaba Cloud account.

Background information

ROS is a free service. You do not need to download or install any package. You can use ROS to create resource stack templates in JSON format. In the ROS console, you can also use a sample template to create a resource stack. For more information, see Sample Template. For example, you can use the LNMP_basic template in the ROS console to automatically create an ECS instance, and deploy the LNMP environment on this instance.

You can also use other sample templates in the ROS console to build other environments, such as Java Web test environments, Node.js development and test environments, Ruby Web development and test environments, or Hadoop and Spark distributed systems.

For more information about ROS, see ROS documentation.

Procedure

  1. Log on to the ROS console.
    Note The first time that you use the ROS service, you are prompted to activate this service. ROS is a free service, so you can activate ROS free of charge.
  2. In the left-side navigation pane, choose Key Help > ECS Instance Information, click the ECS Instance Type tab to find the target instance type in the Instance Type column, click the ECS Zone tab to find the target zone ID in the ZoneId column, and then click the ECS Image tab to find the target image ID in the Image List column.
  3. In the left-side navigation pane, click Sample Template.
  4. Find the sample template LNMP_basic.

    Find the sample template
  5. Click Preview to check the template in JSON format. The following table lists the top-level fields in the JSON file.
    Top-level field Description
    "ROSTemplateFormatVersion" : "2015-09-01" Specifies the version of the template.
    "Description": "Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. ***
                  WARNING *** Only support CentOS-7."
    Describes the use of the template.
    "Parameters" : { } Specifies some parameters. In this example, this field specifies the default image ID and instance type.
    "Resources" : { } Specifies the resources that you can use the template to create. In this example, this field specifies that the resources to be created include an ECS instance and a security group. The properties of these resources are defined in the Parameters field.
    "Outputs": { } Specifies the resource information that the stack outputs after ROS creates the specified resources. In this example, the stack outputs the ECS instance ID, public IP address, and security group ID.
  6. Click Create Stack.
  7. Select the region where the ECS instance is located from the Region drop-down list, such as China (Hangzhou), and click Next.
  8. Set stack parameters, and click Create.
    • Stack Name: specifies a unique stack name. You cannot change the stack name after ROS creates the stack.
    • Creation timeout (minutes): specifies a period. If ROS fails to create the specified resources within the period, the creation operation will time out. You can select or clear Roll back. If you select Roll back, ROS will delete the created resources when an error such as creation timeout occurs during the creation process.
    • Nginx Download Url: specifies the default NGINX download URL.
    • DB Password and (Please Confirm) DB Password: specify the password for accessing a MySQL database and confirm the password. The password must contain only letters and digits.
    • The ECS Available Zone ID: the zone ID of the resource that you want to create. For more information, see Step 2.
    • ECS Image Id: the ID of the image that ROS uses to create the ECS instance. For more information, see Step 2.
    • DB Name: the name of the MySQL database.
    • DB Username: the username of the MySQL database.
    • DB Root Password and (Please Confirm) DB Root Password: specify the password of a MySQL root user and confirm the password. The password must contain only letters and digits.
    • ECS Instance Type: the type of the ECS instance that you want to create. For more information, see Step 2.
    • System Disk Category: the type of the disk.
    • Instance Password and (Please Confirm) Instance Password: specify the password for logon to the ECS instance and confirm the password. The password must contain only letters and digits.

    Configure parameters
  9. In the left-side navigation pane, click Stack Management to check the state of the stack that you have created.

    Stack Management
  10. Click the name of the created stack. In the Output section on the Stack Overview page, check the value of NginxWebsiteURL. You can use the URL to connect to the LNMP environment that you have created.

    Check the stack overview
    Note
    • On the Resource List page, you can check all resources of the stack.
    • On the Event List page, you can check the operations that ROS performs in the process of creating the stack. The causes of failed operations are also displayed in the list.
    • On the Stack Template page, you can check the original template of the stack.