使用tomcat启动SpringBoot项目
https://blog.csdn.net/m0_54849873/article/details/124104937

启动和关闭tomcat

[root@ec-jng-2-01 bin]# ./shutdown.sh   # 关闭tomcat
Using CATALINA_BASE:   /software/apache-tomcat-8.5.83
Using CATALINA_HOME:   /software/apache-tomcat-8.5.83
Using CATALINA_TMPDIR: /software/apache-tomcat-8.5.83/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /software/apache-tomcat-8.5.83/bin/bootstrap.jar:/software/apache-tomcat-8.5.83/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
[root@ec-jng-2-01 bin]# ./startup.sh	# 启动tomcat
Using CATALINA_BASE:   /software/apache-tomcat-8.5.83
Using CATALINA_HOME:   /software/apache-tomcat-8.5.83
Using CATALINA_TMPDIR: /software/apache-tomcat-8.5.83/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /software/apache-tomcat-8.5.83/bin/bootstrap.jar:/software/apache-tomcat-8.5.83/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.

启动成功后出现以下提示:
03-Sep-2022 15:36:38.889 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 798 ms

tomcat控制台输出乱码,修改文件conf\logging.properties UTF-8 改为 GBK

无法将位于[xxx]的资源添加到Web应用程序[]的缓存中,因为在清除过期缓存条目后可用空间仍不足 – 请考虑增加缓存的最大空间。
在tomcat根目录下找到conf下的context.xml文件,Contenxt节点内增加下面内容:

<Resources cachingAllowed="true" cacheMaxSize="1000000" />

部署多个war包

修改server.xml文件,添加多个Service

  <Service name="Catalina">
 
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8888" />
 
    <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="true" autoDeploy="true">
      </Host>
 
    </Engine>
  </Service>
 
 
  <Service name="Catalina2">
 
    <Connector port="8022" protocol="HTTP/1.1"
               connectionTimeout="20000"/>
 
    <Engine name="Catalina2" defaultHost="localhost">
 
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
 
      <Host name="localhost"  appBase="webapps2"
            unpackWARs="true" autoDeploy="true">
      </Host>
    </Engine>
  </Service>

参考地址:https://blog.csdn.net/qq_28581175/article/details/124904731

小屋服务

<!-- 小屋服务 -->
<Service name="xiwangxiaowuService">
 
	<!-- port服务端口 -->
	<Connector connectionTimeout="20000" port="20201" protocol="HTTP/1.1"  URIEncoding="utf-8"/>
 
 
 
	<Connector port="20202"  
    	protocol="HTTP/1.1"
   	 SSLEnabled="true"
    	scheme="https"
   	 secure="true"
    	keystoreFile="/software/apache-tomcat-8.5.83/ssl/7504336_jnch.sqrjkj.cn.pfx"
    	keystoreType="PKCS12"
    	keystorePass="haoagpph"  
    	clientAuth="false"
    	SSLProtocol="TLSv1.1+TLSv1.2+TLSv1.3"
    	ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256"/>
 
 
 
   	<!-- name服务名称 -->
   	<Engine defaultHost="localhost" name="xiwangxiaowuService">
 
     	<Realm className="org.apache.catalina.realm.LockOutRealm">
       		<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
     	</Realm>
    	<!-- appBase=war包存放的新文件夹名称,用来指定对应服务 -->
     	<Host appBase="webapps_xiwangxiaowu" autoDeploy="true" name="localhost" unpackWARs="true">
       		<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
		</Host>
   	</Engine>
</Service>

发表评论

邮箱地址不会被公开。 必填项已用*标注