大家好下面小编给大家介绍一下如何用tomcat 部署多个服务
1.eclipse启动服务,生成代码
2.在我们要部署的服务器下修改Tomcat 8.5\conf下的,主要是修改服务名,修改端口,修改日志名,appBase
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config
--><Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.a;/>
<!-- Security listener. Documentation at /docs/config
<Listener className="org.a; />
-->
<!--APR library loader. Documentation at /doc -->
<Listener SSLEngine="on" className="org.a;/>
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.a;/>
<Listener className="org.a;/>
<Listener className="org.a;/>
<!-- Global JNDI resources
Documentation at /doc
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource auth="Container" description="User database that can be updated and saved" factory="org.a; name="UserDatabase" pathname="con; type="org.a;/>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config
Java AJP Connector: /docs/config
APR (HTTP/AJP) Connector: /doc
Define a non-SSL/TLS HTTP Connector on port 8080
-->
<Connector connectionTimeout="20000" port="8089" protocol="HTTP" redirectPort="8443"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8089" protocol="HTTP"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP Connector on port 8443
This connector uses the NIO implementation with the JSSE engine. When
using the JSSE engine, the JSSE configuration attributes must be used.
-->
<!--
<Connector port="8443" protocol="org.a;
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="con;
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define a SSL/TLS HTTP Connector on port 8443 with HTTP/2
This connector uses the APR/native implementation. When using the
APR/native implementation or the OpenSSL engine with NIO or NIO2 then
the OpenSSL configuration attributes must be used.
-->
<!--
<Connector port="8443" protocol="org.a;
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.a; />
<SSLHostConfig>
<Certificate certificateKeyFile="con;
certificateFile="con;
certificateChainFile="con;
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP; 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 -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine defaultHost="localhost" name="Catalina">
<!--For clustering, please take a look at documentation at:
/doc (simple how to)
/docs/config (reference documentation) -->
<!--
<Cluster className="org.a;/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.a;>
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.a; resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config -->
<!--
<Valve className="org.a; />
-->
<!-- Access log processes all example.
Documentation at: /docs/config
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.a; directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
</Host>
</Engine>
</Service>
上面这段是 原来的内容,修改的时候只要复制修改下面这一段内容就可以了
<Service name="Catalina_ceshi">
<Connector connectionTimeout="20000" port="8089" protocol="HTTP" redirectPort="8443"/>
<Connector port="8081" protocol="AJP; redirectPort="8443"/>
<Engine defaultHost="localhost" name="Catalina_ceshi">
<Realm className="org.a;>
<Realm className="org.a; resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps_ceshi" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.a; directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log_ceshi" suffix=".txt"/>
</Host>
</Engine>
</Service>
</Server>
3.新建 webapps_ceshi文件夹,在该文件下新建ROOT文件夹,然后将生成的代码拷贝到ROOT文件夹下,启动服务,就可以访问了
4.在高级安全防火墙—入站规则中将端口设置到web中,保证外部可以访问
一台电脑上单独部署多个独立的tomcat 服务
949
一台电脑上单独部署多个独立的tomcat服务
如果大家。没有找到一个好的Python交流群可以加入小编的学习交流群;418775537,里面有资料以及各位同行的学习者分享交流