Centos7 install tomcat
Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs.
Apache serves HTML pages, while Tomcat runs JSP pages and Servlet.
1. Install epel
Yum install epel-release-y
two。 Install tomcat
Yum install tomcat-native-y
Yum install tomcat-*-y
# install jar command
Yum install java-1.8.0-openjdk-devel-y
3. Start tomcat
Systemctl start tomcat
Systemctl enable tomcat
4. View listening port
Yum install net-tools-y
Netstat-antupl
5. Download the test program
Find /-name webapps
Cd / var/lib/tomcat/webapps
Wget http://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war
# View Program
Jar-xvf sample.war
6. Write firewall rules
Iptables-I INPUT-p tcp-- dport 80-j ACCEPT
Iptables-I INPUT-p tcp-- dport 8080-j ACCEPT
# Port 80 redirect to 8080
Iptables-t nat-I PREROUTING-p tcp-- dport 80-j REDIRECT-- to-port 8080
Service iptables save
7. Test access
Http://192.168.1.10/sample