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

The correct way to use Homebrew in Linux

Many people use Linux Homebrew. Here are three ti...

Some indicators of excellent web front-end design

The accessibility of web pages seems to be somethi...

Vue basic instructions example graphic explanation

Table of contents 1. v-on directive 1. Basic usag...

How to implement the @person function through Vue

This article uses vue, and adds mouse click event...

How to use Docker to build OpenLDAP+phpLDAPadmin unified user authentication

1. Background Use LDAP to centrally manage operat...

How to quickly import data into MySQL

Preface: In daily study and work, we often encoun...

JavaScript singleton mode to implement custom pop-up box

This article shares the specific code of JavaScri...

A brief introduction to bionic design in Internet web design

When it comes to bionic design, many people will t...

Process parsing of reserved word instructions in Dockerfile

Table of contents 1. What is Dockerfile? 2. Analy...

Let's talk in detail about the props attributes of components in Vue

Table of contents Question 1: How are props used ...

Implementing a puzzle game with js

This article shares the specific code of js to im...

Solve the problems encountered when installing MySQL 8.0 on Win10 system

The problems and solutions encountered when insta...