The following tutorial takes the 10.68.4.38:22 server as an example
1. All tomcat projects are configured to the directory /service
2. Naming rule tomcat-8.0.36-project name
3. New tomcat project operation process:
(1) Copy the basic tomcat package /usr/local/apache-tomcat-8.0.28 and change it to a new name to the directory /service,
For example: cp -rf /usr/local/apache-tomcat-8.0.28 /service/tomcat-8.0.28-test/
(2) Modify the /etc/profile file of linux to add the following content, note that X represents the current number of tomcats:
#tomcat_X
CATALINA_X_BASE=/service/tomcat-8.0.28-humanResourceManager
CATALINA_X_HOME=/service/tomcat-8.0.28-humanResourceManager
TOMCAT_X_HOME=/service/tomcat-8.0.28-humanResourceManager
export CATALINA_X_BASE CATALINA_X_HOME TOMCAT_X_HOME
(3) Modify the configuration file of the new tomcat
Modify the files under tomcat-8.0.36-test/bin: startup.sh and shutdown.sh (the added content is the same), and add the following content to the file:
export JAVA_HOME=/usr/java/jdk1.8.0_60
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JAVA_HOME/bin
export CATALINA_2_HOME =$CATALINA_2_HOME
export CATALINA_2_BASE =$CATALINA_2_BASE
(4) Modify the service.xml file under tomcat-8.0.36-test/conf, and modify (three places) as follows:
- <Serverport="8005"shutdown="SHUTDOWN">
8005 is changed to 8006 (other unused ports can also be used)
- <Connectorport="8080"protocol="HTTP/1.1"
- connectionTimeout="20000"
- redirectPort="8443"/>
Change 8080 to 8081 (other unused ports can also be used)
- <Connectorport="8009"protocol="AJP/1.3"redirectPort="8443"/>
8009 is changed to 8010 (other unused ports can also be used)
4. Open the port, modify the /etc/sysconfig/iptables file, add the following line, XXXX is the port number:
-A INPUT -m state --state NEW -m tcp
-p tcp
--dport 6001 -j ACCEPT
Check if the port is open:
iptables -L -n
5. Restart the firewall
service iptables restart
6. If you still can't access it, it means that some other places have blocked it. Follow up and check and resolve.