Alibaba Cloud server CentOS opens specific ports

Preface

I bought an Alibaba Cloud server and developed some small programs on it. I often need to open the port. Write a blog to record the steps.

Operating environment

  1. Purchased Alibaba Cloud server

Start

1. Use the command lsb_release -a to view the Linux release version

Insert picture description here
Mine is centos7.

2. Enter the command firewall-cmd --state to view the status of the firewall.
3. If the previous step is closed, enter the command:

systemctl start firewalld.service
turns on the firewall.

4. Open port 8080 and enter the command:

firewall-cmd --zone=public --add-port=8080/tcp --permanent
Let us explain the last command:
--zone=public: indicates that the scope is public;
--add-port=8080/tcp: Add the port 8080 of the tcp protocol;
--permanent: permanently effective, if there is no this parameter, it can only maintain the current service life cycle, and it will become invalid after restart;

5. Enter the command to restart the firewall;

systemctl restart firewalld.service

6. Enter the command to reload the configuration;

firewall-cmd --reload

7. Open the official website of Aliyun https://www.aliyun.com/ , and find the console in the upper right corner after logging in

Insert picture description here

Find the ECS you purchased,
Insert picture description here
Insert picture description here
click Manage,
Insert picture description here
click the security group of this instance , click Configure Rules to
Insert picture description here
add security group rules,
Insert picture description here
fill in the example and click OK.
Insert picture description here

Guess you like

Origin blog.csdn.net/u012140251/article/details/89603759