tomcat

jdk环境变量配置

  #加'' 里面的特殊变量才不会解析
cat  >>/etc/profile<<'EOF'
export JAVA_HOME=/application/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/bin:$JAVA_HOME/lib/tools.jar
EOF
                           

安装

查看版本
[root@song application]# /application/tomcat/bin/version.sh 
Using CATALINA_BASE:   /application/tomcat
Using CATALINA_HOME:   /application/tomcat
Using CATALINA_TMPDIR: /application/tomcat/temp
Using JRE_HOME:        /application/jdk
Using CLASSPATH:       /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.27
Server built:   Sep 28 2015 08:17:25 UTC
Server number:  8.0.27.0
OS Name:        Linux
OS Version:     3.10.0-1160.45.1.el7.x86_64
Architecture:   amd64
JVM Version:    1.8.0_60-b27
JVM Vendor:     Oracle Corporation
启动
start.sh 启动
shutdown.sh 关闭
catalina.sh 核心脚本

配置文件

server.xml 主配置文件
web.xml 增加插件优化
Tomcat-users.xml tomcat管理端配置文件
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="host-gui"/>
<user username="admin" password="admin123" roles="admin-gui,manager-gui,host-gui"/>

主配置文件详解server.xml

#连接到这个端口,并输入后面的暗号就可以关闭tomcat
<Server port="8005" shutdown="SHUTDOWN">

#tomcat 管理端
 <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>
#最大线程及最小线程
   <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
Tomcat web 端口
 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
#与apachepe配合
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
#host
    <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- 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

systemctl管理tomcat

[Unit]
1.书写注释,说明服务的作用
2.服务的依赖
[Service]
1,核心部分:指定服务的开启,关闭,重启命令,环境变量
[Install]
1,指定运行级别
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容