LNMP is an acronym for the names of the following 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 stack.
Prerequisites
- ROS is activated. The first time 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. You can also use a sample template in the ROS console to create a stack. For more information, visit the Sample Templates page of the ROS console.
You can 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, and Hadoop and Spark distributed systems. In this topic, the Deploys the LNMP (Linux+Nginx+MySQL+PHP) environment template is used to demonstrate how to use ROS to create an Elastic Compute Service (ECS) instance and deploy an LNMP stack on the instance.
For more information about ROS, see the ROS documentation.
Procedure
- Log on to the ROS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- In the upper-right corner of the Sample Templates page, enter
Deploys the LNMP
in the search box. - Find the Deploys the LNMP (Linux+Nginx+MySQL+PHP) environment template in the search results.
- Click View Details to view the template file in the JSON format. The following table describes the top-level fields of the template file.
Top-level field Description "ROSTemplateFormatVersion": "2015-09-01"
The version of the template. In this example, 2015-09-01 is used. "Parameters": {...}
The parameters of the template. In this example, this field specifies the image ID, instance type, software download URLs, and software configurations. Default values are accepted for some of the parameters. "Resources": {...}
The Alibaba Cloud resources that you want to create based on the template. In this example, this field declares that an ECS instance and a security group are to be created based on the template. The properties of the resources are specified 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 configure labels for each group. In this example, parameters in the Parameters field are divided into different groups based on whether the parameters are instance-related or software-related. Note For more information about the sample templates provided by ROS, see Template structure. - In the upper-left corner of the page, click Create Stack.
- 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 you want to create the ECS instance. Image ID The ID of the image that you want to use for 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 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 the parameters in the Configure Stack (Optional) step and the Check and Confirm (Optional) step.After the stack is created, you are redirected to the details page of the stack. You can view the status of the stack on the Stack Information tab. - Click the Outputs tab and view the URL in the
Value
column of NginxWebsiteURL.Use the URL to connect to the LNMP stack that you created.Note- On the Resources tab, you can view all resources in the stack.
- On the Events tab, you can view the logs of the operations that ROS performed to create the stack.