Purchase the server. Purchase the server address: Purchase the server on CentOS7

Installation and configuration of tomcat 1, download tomcat: download the address

img

Add tomcat environment variables to **/etc/profile**. Export the CATALINA_HOME = / wocloud/tomcat_cluster/tomcat1 / apache tomcat — 7.0.57

**/root/apache-tomcat-7.0.73/bin** /startup.sh, if the following image is displayed, the startup is successful.

img

In CentOS 7, a more powerful Firewall is introduced, the Firewall. We need to enable ports 8080 and 8009 in the Firewall (these two ports are the default ports used by Tomcat to access the Tomcat server. If you change the ports, you need to change the ports by yourself), that is, add ports 8080 and 8009 to the zone (a new feature of the Firewall, It defines the trust level of a network area network connection. The command is as follows:

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

Copy the code

Add port 8081 to the public zone. Permanent indicates that port 8081 is permanent.

firewall-cmd --reload

Copy the code

OK, let’s look at all the open ports in the public area.

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

Copy the code
img

6, you may think that this will be able to access, in fact, still not, because there is a layer of firewall in Ali Cloud, we need to develop 8080 and 8009 ports in Ali cloud server management:

img

Tomcat can be accessed via the server’s external IP or domain name:

img