Alibaba Cloud Server Tomcat cannot be accessed

Alibaba Cloud Server Tomcat cannot be accessed

1. Introduction

I have configured Tomcat on Alibaba Cloud before, and it was accessible after testing. Later, I uninstalled Tomcat for some reasons. I started to reinstall Tomcat and start testing last night, but found that it was still inaccessible. Then I wasted another night. The main reasons may be the following. I hope it can help you.

2. Solution

Alibaba Cloud has two layers of inspection measures. The first layer is the firewall, and the second layer is the security group. Here we first configure the firewall

2.1 Configure the firewall and open the port

Here we first check whether the firewall status is turned on

systemctl status firewalld
``
If this error `Unit firewalld.service could not be found.` appears, it means that we do not have the firewall service, and we need to download the firewall first;

```java
yum install firewalld firewall-config

After the download is complete, we need to start the firewall first:

service firewalld start

After the startup is complete, we open Tomcat's port 8080

firewall-cmd --zone=public --permanent --add-port=8080/tcp

After opening the port, we need to refresh the effect, which can be achieved by the following command:

firewall-cmd --reload

After refreshing, we can check the opened port number through the following command:

firewall-cmd --list-all

If you see the following interface, it means that the firewall has opened the following ports

insert image description here

2.2 Configure security groups in the Alibaba Cloud console

insert image description here
insert image description here

It should be noted here that it is best to configure both the inbound and outbound directions of port 8080, so that the security group has also been configured.

2.3 Check ports and resolve port conflicts

At this time, we start Tomcat. Here we enter the bin directory of Tomcat and start Tomcat through the following command

./startup.sh

It is best not to use the sh startup.sh command to start Tomcat
At this time, if your ports do not conflict, then you can visit阿里云ip:8080 , and you should be able to see the Tomcat page, but if you don't see it, it basically means that there is a port conflict. At this time, we need to check the port to see which port is conflicting. At this time, we need to check the log, usually in this path

insert image description here

Enter and view through vi 日志名,
Seeing errors similar to this

org.apache.catalina.core.StandardServer.await StandardServer.await: create[localhost:8106]:

This means that the port has conflicted and needs to be modified. Then we need to go to conf/server.xml to modify and find the corresponding port number.

insert image description here

There are mainly several places where port numbers may conflict:

insert image description here
insert image description here
insert image description here

Modify the port according to your actual situation. Start Tomcat every time you modify it. If there is no port error, it means that Tomcat can start normally.

Just like that, my lovely Tom cat finally came out, thank God.

insert image description here

This is the end of this article about Alibaba Cloud Server Tomcat being inaccessible. For more relevant Alibaba Cloud Server Tomcat content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed tutorial on installing Tomcat8.5 in Centos8.2 cloud server environment
  • Solution to slow response of Tomcat server
  • Detailed steps for configuring Tomcat server in IDEA 2020
  • Detailed steps for installing JDK and Tomcat on Linux cloud server (recommended)
  • Tomcat Server Getting Started Super Detailed Tutorial

<<:  How to migrate local mysql to server database

>>:  Problem record of using vue+echarts chart

Recommend

Implementation of Docker container connection and communication

Port mapping is not the only way to connect Docke...

How to transfer files between Windows and Linux

File transfer between Windows and Linux (1) Use W...

MySQL 8.0.22 winx64 installation and configuration method graphic tutorial

The database installation tutorial of MySQL-8.0.2...

How to install and configure WSL on Windows

What is WSL Quoting a passage from Baidu Encyclop...

Detailed explanation of Angular component projection

Table of contents Overview 1. Simple Example 1. U...

Detailed explanation of MySQL Explain

In daily work, we sometimes run slow queries to r...

Solution to MySQLSyntaxErrorException when connecting to MySQL using bitronix

Solution to MySQLSyntaxErrorException when connec...

Detailed explanation of nginx configuration file interpretation

The nginx configuration file is mainly divided in...

Summary of the Differences between SQL and NoSQL

Main differences: 1. Type SQL databases are prima...

SQL GROUP BY detailed explanation and simple example

The GROUP BY statement is used in conjunction wit...

Summary of coalesce() usage tips in MySQL

Preface Recently, I accidentally discovered MySQL...

MySQL multi-instance configuration application scenario

Table of contents MySQL multiple instances Multi-...