Linux下tomcat修改为war包部署

修改tomcat下conf下的server.xml文件
<?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

http://www.apache.org/licenses/LICENSE-2.0

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.html
-->
<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 -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</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.html
-->
<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/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="utf-8"
/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<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">
-->
<Engine name="Catalina" defaultHost="localhost">

<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->

<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- 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.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>

<Host name="localhost" appBase="webapps"
unpackWARs="false" autoDeploy="false">
<Context path="" docBase="ROOT/pcweb.war"/>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />

</Host>
</Engine>
</Service>
</Server>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 在Linux部署TomcatWAR,需要按照以下步骤进行操作: 1. 首先,将WAR上传到Linux服务器上的Tomcat的webapps目录下。 2. 然后,进入Tomcat的bin目录,执行startup.sh启动Tomcat。 3. 等待Tomcat启动完成后,可以通过浏览器访问Tomcat的管理页面,查看WAR是否已经成功部署。 4. 如果需要对WAR进行配置,可以编辑Tomcat的conf目录下的server.xml文件,添加相关配置信息。 5. 部署完成后,可以通过Tomcat的管理页面对WAR进行管理,括启动、停止、卸载等操作。 总之,部署TomcatWAR需要注意一些细节,如上传路径、启动命令、配置文件等,只有按照正确的步骤进行操作,才能确保WAR能够正常运行。 ### 回答2: Tomcat作为一个Web服务器,在Linux操作系统下部署war也是比较简单的。下面介绍一下部署的具体步骤。 步骤一:安装Tomcat 首先需要在Linux服务器上安装Tomcat,并且确保Tomcat的版本与war兼容。可以在从官方网站下载Tomcat安装,并按照指导进行安装。 步骤二:创建Web应用目录 创建一个要部署Web应用的目录,例如 /usr/local/tomcat/webapps/mywebapp 。这个目录将会成为运行Web应用的根目录。 步骤三:上传warwar上传到Tomcat的webapps目录中。上传后,Tomcat会自动解压并将其部署为一个Web应用。 步骤四:启动Tomcat 使用命令行进入到Tomcat的bin目录下,运行startup.sh脚本文件启动Tomcat。 步骤五:测试运行 在浏览器中输入 http://localhost:8080/mywebapp (如果8080不是Tomcat的默认端口,则需要修改为相应的端口号),如果出现Web应用的首页,则表示Web应用已经成功部署并运行。 以上就是在Linux部署war的具体步骤。如果需要对Web应用进行配置和管理,可以通过Tomcat的管理界面进行操作。 ### 回答3: Tomcat是一款流行的开源Web应用服务器,能够支持Java Servlet和JSP的部署与执行。本篇文章将讨论如何在Linux系统下部署war文件。 1. 下载和安装TomcatLinux系统上安装Tomcat,需要下载并解压缩Tomcat安装文件。解压后得到一个文件夹,进入这个文件夹,执行bin目录下的startup.sh脚本即可启动Tomcat服务。 2. 上传warwar上传到Linux服务器,可以使用FTP、SCP等命令进行上传,也可以使用GUI工具进行上传。将上传的war保存在Tomcat的webapps目录下。 3. 解压war Tomcat启动后会自动解压war,生成对应的文件夹和文件。Tomcat的webapps目录下存放的是解压后的文件夹,每个文件夹对应着一个web应用。 4. 配置虚拟主机 如果需要部署多个web应用,在Tomcat中需要使用虚拟主机来管理这些web应用。配置虚拟主机可以在Tomcat的conf目录下的server.xml文件中进行。 5. 部署war 部署war的方式有两种: (1)手动部署:将war拷贝到Tomcat的webapps目录下即可。 (2)自动部署:在Tomcat上启用自动部署功能,只需将war拷贝到Tomcat的autodeploy目录下即可。 6. 重启Tomcat服务 部署war后,需要重启Tomcat服务使配置生效。可以使用bin目录下的shutdown.sh脚本关闭Tomcat服务,再使用startup.sh脚本重新启动Tomcat服务。 总的来说,Linux操作系统下Tomcat部署war比较简单。只需要将war上传到Tomcat的webapps目录下,自动解压并部署即可。如果需要部署多个web应用,可以配置虚拟主机来管理这些应用。注意重启Tomcat服务使配置生效。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值