What is Tomcat?
Tomcat is a core project of the Jakarta project of the Apache Software Foundation, which is jointly developed by Apache, Sun and other companies and individuals. With Sun's participation and support, the latest Servlet and JSP specifications can always be reflected in Tomcat. Tomcat 5 supports the latest Servlet 2.4 and JSP 2.0 specifications. Because Tomcat technology is advanced, stable performance, and free, it is loved by Java enthusiasts and recognized by some software developers, becoming a more popular Web application server.
Tomcat server is a free open source Web application server, which belongs to 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. For a beginner, you can think that when you configure the Apache server on a machine, you can use it to respond to the access request of an HTML (Standard General Markup Language) page. In fact, Tomcat is an extension of Apache server, but it runs independently at runtime, so when you run tomcat, it actually runs as a separate process from Apache.
Tomcat single machine multi instance
Directory structure: bin (run script) conf (configuration file) lib (core library file) logs (log directory) Temp (the directory the JVM uses for temporary files (java.io.tmpdir) webapps (automatically loaded Web Applications) work (Web application temporary working directory)
# Upload installation package
apache-tomcat-8.5.35.tar
jdk-8u131-linux-x64_ .rpm
# Decompression jdk [root@ chenc01 ~]# rpm -ivh jdk-8u131-linux-x64_.rpm
# Unzip Apache Tomcat [root@ chenc01 ~]# tar zxf apache-tomcat-8.5.35.tar.gz
# Create file directory [root@ chenc01 ~]# cd /usr/local/ [root@ chenc01 local]# mkdir tomcat1 [root@ chenc01 local]# mkdir tomcat2
# Extract Apache Tomcat and copy to tomcat1 and tomcat2 [root@ chenc01 ~]# cp -r apache-tomcat-8.5.35 /usr/local/tomcat1/ [root@ chenc01 ~]# cp -r apache-tomcat-8.5.35 /usr/local/tomcat2/
# Modify port default 8080 [root@ chenc01 local]#vim /usr/local/tomcat1/apache-tomcat-8.5.35/conf/server.xml <Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> -->
# start-up [root@ chenc01 local]#/usr/local/tomcat1/apache-tomcat-8.5.35/bin/startup.sh
# Modify port default 8081 [root@ chenc01 local]#vim /usr/local/tomcat2/apache-tomcat-8.5.35/conf/server.xml <Server port="8006" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> -->
# start-up [root@ chenc01 local]#/usr/local/tomcat2/apache-tomcat-8.5.35/bin/startup.sh