This tutorial walks you through the procedure to configure Apache for a Linux CentOS 8.0 instance of the ecs.g6.large instance type. You can use this tutorial to familiarize yourself with operations in the ECS console.
- Create an account and complete the account information.
- Optional: Alibaba Cloud provides a default Virtual Private Cloud (VPC). If you do not want to
use the VPC that is provided, you can also create a VPC and a VSwitch in the target
For more information about how to create a VPC, see Create an IPv4 VPC.
- Optional: Alibaba Cloud provides a default security group. If you do not want to use the security
group that is provided, you can also create a security group in the target region
where the instance is created.
For more information about how to create a security group, see Create a security group.
Step 1: Create an ECS instance
- Go to the ECS Custom Launch page.
- On the first four configuration pages of the buy page, complete the instance launch
The following configurations are used in this tutorial. For configurations that are not described in this tutorial, use default ones.
Configuration page Parameter Example Description Basic Configurations Billing Method Pay-As-You-Go Pay-as-you-go allows more flexible operations. For more information, see Billing overview.Note If ICP filing is required for your domain name, you must select Subscription. Region
- Region: China (Hangzhou) or other
- Zone: Random
You cannot change the region or zone after the instance is created. Exercise caution when you configure this parameter. Instance Type
- Family: General Purpose Type g6
- Instance Type: ecs.g6.large
Instance types that are available are determined by the region you select and the inventory in the region.
You can go to the ECS Instance Types Available for Each Region page to view the instance types available in each region.
- Type: Public Image
- Version: CentOS 8.0 64-bit
After the instance is started, the operating system and application data of the image are copied to the system disk. Networking VPC [Default]vpc-bp1opxu1zkhn00g****** Resources that are prefixed with [Default] are automatically created in the ECS console. Assign Public IP Address Select The system allocates a public IPv4 address if you select Assign Public IP Address. Bandwidth Billing Pay-By-Traffic In Pay-By-Traffic mode, bandwidth is billed based on the amount of bandwidth used. For more information, see Billing methods of Internet bandwidth. Peak Bandwidth 2 Mbit/s None. Security Group
- Security Group ID: [Default]sg-bp1bhjjsoiyx44******
- Rule: Select ICMP, SSH 22, RDP 3389, HTTP 80, and HTTPS 443.
Resources that are prefixed with [Default] are automatically created in the ECS console. System Configurations Logon Credentials Password Record the password. It is the password for root and is required when you perform the operations in Connect to the ECS instance. Instance Name
In this tutorial, EcsQuickStart is used as the instance name. Grouping Tags ECS:Documentation If multiple instances are created, we recommend that you add tags to help facilitate management.
- Click Next: Preview. On the page that appears, confirm the Configurations Selected, or click the icon to modify the configurations.
- Optional: Click Save as Launch Template. Set Template Name and Version Description.
Note Save the configurations selected for the current instance as a launch template. You can create an instance in one click by using the template.
- Read and select ECS Terms of Service. Click Create Instance.
- In the Created message that appears, click Console to view the creation progress on the Instances page.
If the instance status is Running, the instance is created. Copy the public IP address of the instance to use when you connect to the ECS instance.
Step 2: Add security group rules
If you did not select any rules in the default security group when you created the ECS instance, or the ECS instance was added to a new security group, you can follow these steps.
- Click the instance ID to go to the instance details page.
- In the left-side navigation pane, click Security Groups. Click the security group ID to go to the security group details page.
- In the upper-right corner of the Security Group Rules page, click Quick Rule Creation.
- Add security group rules as described in the following table. For configurations that
are not described in this tutorial, use default ones.
Rule Direction Action Common Port (TCP) Authorization Type Authorization Object Inbound Allow
- SSH 22
- RDP 3389
- HTTP 80
- HTTPS 443
IPv4 CIDR Block 0.0.0.0/0Note
- For Common Port (TCP), select the port that must be enabled for the applications that run on the ECS instance. For example, if you want to use SSH and Apache in Step 4: Configure Apache, you must select SSH 22 and HTTP 80 in this step. Otherwise, the instance will not respond in subsequent operations.
- 0.0.0.0/0 indicates that devices in all network segments are allowed to access the specified port. If you know the IP address of the requester, we recommend that you set Authorization Object to a specific IP address range.
- Click OK.
Step 3: Connect to the ECS instance
- Return to the Instances page and find the EcsQuickStart instance.
- In the Actions column, click Connect.
- In the Enter VNC password dialog box that appears, click Change VNC password.
- Change the password as prompted. In the Enter VNC password dialog box that appears, enter your new password. Click OK.
- Configure the logon credentials.
- Username: Enter root.
- Password: Enter the Password that you set for Logon Credentials when you created the ECS instance.
Step 4: Configure Apache
- Install Apache.
yum install -y vsftpd
- Start Apache.
systemctl start httpd
- Enable Apache to run at startup.
systemctl enable httpd
- Check whether Apache is running.
systemctl status httpdThe command output
active (running)indicates that Apache is running.
- Open a web page in the current browser. Enter the public IP address of the instance
in the address bar. Press Enter.
http://<Public IP address of the instance>
Step 5 (optional): Resolve domain names
Direct access to Apache by using the public IP address of the instance may degrade server security. If you already have a domain name or want to register one for the Apache website, follow these steps:
- Register a domain name.
For more information, see Register a domain name.
- If the website to which the domain name directs is hosted on an ECS instance in mainland
China regions, you must apply for ICP filing for the domain name.
For more information, see Apply for an ICP filing.
- Resolve the domain name to point to the public IP address of the instance.
Domain name resolution is a prerequisite for using domain names to access your website. For more information, see Add and manage records.
- Use the resolved domain name to access Apache. Example: https://ecs-quickstarts.info.
Step 6 (optional): Release the ECS instance
You can release the instance if you no longer need it. After the instance is released, billing stops and data cannot be recovered.
- Return to the Instances page and find the EcsQuickStart instance.
- In the Actions column, choose .
- In the Release dialog box that appears, select Release Now. Click Next.
- Confirm the instance to release. Click OK.
Step 7: View bills
- On the top navigation bar, choose .
- In the left-side navigation pane, choose .
- Set Search By to Instance ID. Enter the ID of the EcsQuickStart instance. Press Enter to start the search.
What to do next
- For more information about ECS instance families that are available for purchase, see Instance families
- For more information about how to create an ECS instance, see ECS instance creation overview
- For more information about images, see Image overview
- For more information about security groups, see Security group overview
- For more information about VPCs, see What is a VPC?
- For more information about the common operations of ECS, see Quick reference
- For more information about the API operations provided by ECS, see API overview