Solution to the inaccessibility of Tencent Cloud Server Tomcat port

Solution to the inaccessibility of Tencent Cloud Server Tomcat port

I recently configured a server using Tencent Cloud. When using it, I found that the tomcat port was inaccessible, so I looked for some information on the Internet. There are two situations in total. I summarize them below. I hope it will be helpful to everyone and also leave a note for myself.

First case:

As the title says: https://console.cloud.tencent.com/cvm/securitygroup You need to go to this address to set up a security group.

To be honest, I don't know whether I should say "mmp" or not. The instructions for use are too confusing.

Of course, changing the security group and firewall still doesn't work. So I checked Tomcat's records and found:

/home/apache-tomcat-8.5.37/bin/catalina.sh: line 482: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/bin/java: No such file or directory

This is obviously a problem with the environment variable configuration. The reason is that the previous installation diagram I used was simple and practical yum installation, and the environment variables were three lines of code copied from the Internet, and I didn't check carefully to see if they were correct. Okay, let’s take a dive once.

Of course, this problem can also be seen by checking the running status of tomcat

ps -ef|grep tomcat

The picture above is problematic.

This is normal, which is affected by the Java environment variable configuration.

The actual installed JDK information does not match the environment variable configuration. So I modified the java version information in the environment variable, and finally it was done

Modifying environment variables is described in my previous blog

Tencent Cloud deploys one of the Java Web projects, application server

Second case:

Enter the command netstat -tunlp and you can see that port 8080 is not open at all. How can I access it?

So how to enable it? Because Centos7 and above use firewalld instead of iptables, that is to say, firewalld should open port 8080.

1. Check the firewall status.

firewall-cmd --state #Check the firewall status.

The result is running or not running

If not turned on

systemctl start firewalld

2. In the running state, add the ports that need to be opened to the firewall

firewall-cmd --permanent --zone=public --add-port=8080/tcp #Permanently add this port. Remove --permanent to indicate temporary.

The corresponding shutdown command is

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

3. Load the configuration to make the changes effective.

firewall-cmd --reload

Use the command to check the open ports, and 8080/tcp appears, which is opened correctly.

firewall-cmd --permanent --zone=public --list-ports

Don't forget to restart the firewall.

systemctl start firewalld.service

Check again that port 8080 is open

The most annoying thing is Tencent Cloud's server, after all these and the security group are set up. You have to wait for a while, and then access to Tomcat will be successful.

Any access errors that occurred during this time were not related to the operation. The delay is severe.

This is the end of this article about the solution to the problem that the tomcat port of Tencent Cloud Server is inaccessible. For more relevant content about the problem that the tomcat port of Tencent Cloud is inaccessible, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Tutorial on installing and configuring Tomcat on Alibaba Cloud Server and adding external network access ports
  • Tomcat multi-port domain name access and configuration to enable gzip compression method
  • Detailed explanation of setting the default server and accessing without port name in Tomcat 7.0
  • How to implement multi-port and multi-domain access to a tomcat
  • Jsp and PHP share port 80 to integrate Apache and Tomcat (no need to add port number when accessing)

<<:  Web front-end performance optimization

>>:  Vue.js style layout Flutter business development common skills

Recommend

How to configure VMware multi-node environment

This tutorial uses CentOS 7 64-bit. Allocate 2GB ...

How to add shortcut commands in Xshell

As a useful terminal emulator, Xshell is often us...

React internationalization react-i18next detailed explanation

Introduction react-i18next is a powerful internat...

Several ways to run Python programs in the Linux background

1. The first method is to use the unhup command d...

A case study on MySQL optimization

1. Background A sql-killer process is set up on e...

Vue project implements left swipe delete function (complete code)

Achieve results The code is as follows html <t...

Vue achieves the top effect through v-show

html <div class="totop" v-show="...

VSCode+CMake+Clang+GCC environment construction tutorial under win10

I plan to use C/C++ to implement basic data struc...

Detailed steps for setting up host Nginx + Docker WordPress Mysql

environment Linux 3.10.0-693.el7.x86_64 Docker ve...

Linux 6 steps to change the default remote port number of ssh

The default ssh remote port in Linux is 22. Somet...

Summary of 3 ways to lazy load vue-router

Not using lazy loading import Vue from 'vue&#...

How to use JS WebSocket to implement simple chat

Table of contents Short Polling Long-Polling WebS...

SMS verification code login function based on antd pro (process analysis)

Table of contents summary Overall process front e...