LNMP is an acronym of the names of its original four open source components: the Linux operating system, NGINX web server, MySQL relational database management system, and PHP programming language. This topic describes how to use Alibaba Cloud Resource Orchestration Service (ROS) to deploy an LNMP environment.


The first time that you use ROS, you are prompted to activate it. ROS is a free service. You can activate ROS free of charge.

Background information

You do not need to download or install anything to use ROS. You can use ROS to create stack templates in the JSON format. In the ROS console, you can also use a sample template to create a stack. For more information, visit the Sample Templates page of the ROS console.

You can also use the sample templates provided by ROS to build 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 uses the Deploy a LNMP (Linux, NGINX, MySQL, and PHP) Stack template to demonstrate how to use ROS to create an Elastic Compute Service (ECS) instance and deploy an LNMP environment on the instance.

For more information about ROS, see ROS documentation.


  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.
    Deploy a LNMP (Linux, NGINX, MySQL, and PHP) Stack template
  5. Click View Details to view the template in the JSON format.
    The following table describes the top-level fields of the JSON file.
    Top-level field Description
    "ROSTemplateFormatVersion": "2015-09-01" The version of the template. A value of 2015-09-01 is used.
    "Parameters": {...} Some parameters of the template. In this example, this field specifies the image ID, instance type, software download URLs, and software configurations, and default values are accepted for some of these parameters.
    "Resources": {...} The Alibaba Cloud 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": {...} The resource information that the stack generates after the specified resources are created. In this example, the stack generates the IP address that is used to access NGINX.
    "Description": "Deploy LNMP(Linux+Nginx+MySQL+PHP) stack on 1 ECS instance. ***
                  WARNING *** Only support CentOS-7."
    The description of the template.
    "Metadata": {...} Divides parameters in the Parameters field into groups. You can set labels for each group. In this example, parameters in the Parameters field are put into different groups based on whether they are ECS instance-related or software-related.
    Note For more information about sample templates of ROS, see Template structure.
  6. In the upper-left corner of the page, click Create Stack.
  7. Configure the parameters described in the following table and click Create.
    Parameter Description
    Stack Name The name of the stack.
    Available Zone ID (Required) The ID of the zone in which to create the ECS instance.
    Image ID The ID of the image to be used by the ECS instance.
    Instance Type (Required) The instance type of the ECS instance.
    System Disk Category The system disk category of the ECS instance.
    Instance Password (Required) The logon password of the ECS instance.
    DB Name The name of the MySQL database.
    DB Username The username of the MySQL database.
    DB Password (Required) The password of the MySQL database.
    DB Root Password (Required) The administrator (root) password of the MySQL database.
    Nginx Source The URL from which to download NGINX. We recommend that you use the default value.
    Note You can optionally click Next to go to the Configure Stack (Optional) step and then to the Check and Confirm (Optional) step. For more information, see Create a stack. In this example, default values are accepted for parameters in the Configure Stack (Optional) and Check and Confirm (Optional) steps.
    After the stack is created, you are redirected to the details page of the stack. You can view the state of the stack on the Stack Information tab. LNMP stack state
  8. Click the Outputs tab and view the URL in the Value column corresponding to NginxWebsiteURL.
    You can use the URL to connect to the LNMP environment that you have created.
    Nginx URL
    • On the Resources tab, you can view all of the resources in the stack.
    • On the Events tab, you can view logs about the operations that ROS performed to create the stack.