An LNMP environment is based on four major components: Linux, NGINX, MySQL, and PHP. This topic describes how to use Resource Orchestration Service (ROS) to deploy LNMP environments.

Prerequisites

  • You must have registered an Alibaba Cloud account. If not, create a new Alibaba Cloud account first.
  • You will be prompted to activate ROS the first time you use the service. ROS is a free service and thus can be activated free of charge.

Background information

ROS is a free service. You do not need to download or install anything to use ROS. 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 Templates.

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. This topic employs the Deploy a LNMP (Linux, NGINX, MySQL, and PHP) Stack template to demonstrate how to use ROS to automatically create an ECS instance and deploy an LNMP environment on the instance.

For more information about ROS, see ROS documentation.

Procedure

  1. Log on to the ROS console.
  2. In the left-side navigation pane, choose Templates > Sample Templates.
  3. In the top navigation bar, select a region.
  4. Find the Deploy a LNMP (Linux, NGINX, MySQL, and PHP) Stack template.
    Find the sample template
  5. Click View Details 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 template and how it is used.
    "Parameters" : { } Specifies template parameters. For this example, this field specifies the default image ID and instance type.
    "Resources" : { } Specifies the resources that you can use the template to create. For 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. For this example, the stack outputs the ECS instance ID, public IP address, and security group ID.
  6. Click Create Stack.
  7. Set the parameters and click Create Stack.
    Parameter Description
    Stack Name Specifies a unique stack name. You cannot change the stack name after ROS creates the stack.
    Nginx Download Url Use the default NGINX download URL.
    DB Password The password used to access the MySQL database. The password can only contain letters and digits.
    Confirm DB Password Confirm the password used to access the MySQL database.
    Available Zone ID The zone ID of the resource that you want to create.
    Image ID The ID of the image that ROS uses to create the ECS instance.
    DB Name The name of the MySQL database.
    DB Username The username of the MySQL database.
    DB Root Password The password of a MySQL root user. The password can only contain letters and digits.
    Confirm DB Root Password Confirm the password of a MySQL root user.
    Instance Type The type of the ECS instance that you want to create.
    System Disk Category The disk category of the system disk.
    Instance Password The password used to log on to the ECS instance. The password can only contain letters and digits.
    Confirm Instance Password Confirm the password used to log on to the ECS instance.
  8. In the left-side navigation pane, click Stacks to check the status of the stack that you have created.
    Stacks
  9. Click the name of the new stack. Click the Outputs tab and check the NginxWebsiteURL value.

    You can use the URL to connect to the LNMP environment that you have created.

    Check the stack details
    Note
    • On the Resources tab, you can check all of the resources in the stack.
    • On the Events tab, 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.