centos云服务器基础配置详解(三)安装tomcat

centos云服务器基础配置详解(一)搭建JDK    
centos云服务器基础配置详解(二)安装Mysql   

在前两篇中我们已经成功安装了jdk和mysql,接下来安装tomcat运行程序即可

tomcat下载

http://tomcat.apache.org/download-80.cgi

下载成功后,通过rz命令上传到云服务器

如果没有安装rz命令,执行

yum install lrzsz

上传成功后,执行安装

tar -zxvf apache-tomcat-8.5.15.tar.gz

成功后,当前目录下多出一个apache-tomcat-8.5.15目录,此为tomcat的根目录。下边直接运行即可

打开运行目录

cd apache-tomcat-8.5.15/bin/

运行tomcat

./startup.sh 

查看是否运行成功

ps -ef|grep tomcat
运行成功后,输入主机ip+:8080即可打开tomcat主页

当然这样并不能满足我。

接下来更改tomcat

首先清空tomcat中自带的界面,在根目录下执行

rm -rf webapps/*

配置conf目录下server.xml。这里我采用的是映射部署,

<?xml version='1.0' encoding='utf-8'?>
<Server port="8051" shutdown="SHUTDOWN">
	<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
	<Listener className="org.apache.catalina.core.JasperListener" />
	<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
	<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
	<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
	<GlobalNamingResources>
		<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>
	<Service name="Catalina">
	<!--	<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="utf-8" redirectPort="8443" />
		<Connector port="8091" protocol="AJP/1.3" redirectPort="8443" URIEncoding="utf-8" maxThreads="1024" connectionTimeout="20000"/>-->
		<Executor name="tomcatThreadPool" namePrefix="catalina-exec-1"  maxThreads="1000" minSpareThreads="25"  maxIdleTime="600000"/>

		<Connector executor="tomcatThreadPool"  port="80" protocol="org.apache.coyote.http11.Http11Protocol"  URIEncoding="UTF-8" useBodyEncodingForURI="true"
enableLookups="false" disableUploadTimeout="true"
                maxThreads="500"     
                                      minSpareThreads="25"     
                                                                  maxSpareThreads="75"                   connectionTimeout="20000" acceptCount="800"     bufferSize="8192"            keepAliveTimeout="15000" maxKeepAliveRequests="10000"                 compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" redirectPort="8443"/>

		<Connector port="8091" protocol="AJP/1.3" URIEncoding="UTF-8" enableLookups="false"  connectionTimeout="20000" keepAliveTimeout="15000" maxKeepAliveRequests="1000" />
		<Engine name="Catalina" defaultHost="localhost">
			<Realm className="org.apache.catalina.realm.LockOutRealm">
				<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
			</Realm>

		<!--	<Host name="localhost"  appBase="webapps" unpackWARs="false" autoDeploy="false">
				<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
			</Host>-->
               <Host autoDeploy="false" name="localhost" unpackWARs="false">
               <!--<Context docBase="" path="/probe" privileged="true" />-->

               <Context docBase="这里配置项目在linux中的路径"   path="" reloadable="false">
                 
	<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="10000" maxIdle="5" maxWait="2880000" name="数据库账号" password="数据库密码" type="javax.sql.DataSource" url="这里是数据库连接" username="数据库账号"/>
                    </Context>
                           <!--<Context path="/solr" reloadable="false" docBase="/website/site/sites/website/hefeng/WebRoot/search/solr/project" />-->
      </Host>

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

然后关闭tomcat

killall java

重新启动

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风晴03

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值