Three issues need to be mentioned here
The first aspect: the problem of starting the firewall on Linux
The most popular Linux image is CentOS, so the firewall has also become a firewall, so how to operate this firewall?
#停止firewall
systemctl stop firewalld.service
#开启firewall
systemctl start firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
#查看默认防火墙状态(关闭后显示not running,开启后显示running)
firewall-cmd --state
But when it is turned on, it may report this error
Failed to start firewalld.service: Unit firewalld.service is masked.
After searching for a long time, I couldn't find a solution, so I tried to enter the following command and solved it.
systemctl unmask firewalld.service
The second aspect: check whether it can be accessed
Take a look at some commands:
#启动tomcat, 在tomcat目录下(官方名称:apache-****)
bin/startup.sh
#关闭tomcat, 在tomcat目录下(官方名称:apache-****)
bin/shutdown.sh
#如果关闭出错,可以杀死线程
ps -ef | grep tomcat
kill *(端口)
#访问
curl 127.0.0.1:8080
curl ip:8080
The third aspect: external network access problems
When we use curl ip:8080, we will find that we cannot access it, so what is the problem?
A: Firewall
B:. . .
It was found that the firewall has been closed. After a lot of searching, it was found that it may also be a problem with the security group. After testing, it passed.
So how to configure the security group?
1. Log in to Alibaba Cloud
2. Enter the security group
"Console" -> "Cloud Server ECS" -> select the cloud server -> "More" -> "Security Group Configuration"
3. Configuration rules
"Configure Rules" -> "Add Security Group Rules"
4. Configure port 8080
Click OK and try again!
Whether you solved it or not, I solved it anyway~