Install Tomcat on AWS service ec2

Opened an EC2 instance (Linux system) on AWS. Install Tomcat on it and run the web project. The operation is as follows:

1. Download Tomcat for Linux

http://tomcat.apache.org/    

 The next version is 8.5.29



 

After downloading, put the downloaded tar.gz on the Linux server /opt/upload, and then decompress it:

tar zxvf apache-tomcat-8.5.29.tar.gz

 

2. Put test.war in the webapp directory of tomcat. Then start Tomcat.

(Note: If the java environment is not installed in the server, jdk needs to be installed)

The startup is normal, but the external network ip cannot be accessed through the browser.

When this happens, a three-step process is performed:

1) Modify the Tomcat 8080 port to 8089, as if aws has something to do with 80 and 8080 ports. Just change it, haha~

 

2) Close the Linux firewall or add port 8089 to the firewall, and then restart the firewall.

Inquire:

iptables -L -n

Add to:

iptables -I INPUT -p TCP --dport 8089 -j ACCEPT

Reference: https://www.cnblogs.com/xdp-gacl/p/4097608.html

 

3) Add the instance in the AWS service to the security group and configure the "custom TCP rule" - port 8089.



 

4, ok, start Tomcat, you can access.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326044127&siteId=291194637