Tomcat 安装 2019.1.20

版本选择: https://tomcat.apache.org/whichversion.html

 

# cd   /data/installpack

# wget http://t-down.oss-cn-hangzhou.aliyuncs.com/ apache-tomcat-8.5.35.tar.gz

# ll  -a

# tar -zxvf apache-tomcat-8.5.35.tar.gz  -C /usr/local/

# ln  -s  /usr/local/tomcat-8.5.35/  /usr/local/tomcat

# ll  /usr/local/

 启动tomcat时,默认地址:http://IP:8080,能访问,即成功。

 server.xml引入子文件配置(tomcat虚拟主机)

第1步,配置

# cd /usr/local/tomcat/conf/
# cp server.xml server.xml.bak
# vim  server.xml

 添加内容1.在第一行的下面添加,注意第一行,不要重复。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server-xml [
<!ENTITY vhost-img.evhtech.cn SYSTEM "file:///usr/local/tomcat/conf/vhost/img.evhtech.cn.xml">
<!ENTITY vhost-api.evhtech.cn SYSTEM "file:///usr/local/tomcat/conf/vhost/api.evhtech.cn.xml">
<!ENTITY vhost-style.evhtech.cn SYSTEM "file:///usr/local/tomcat/conf/vhost/style.evhtech.cn.xml">
]>

添加内容2.在默认Host的下面。 

<!--  Engine之间,Realm之下的,默认<Host>.省略.</Host>的下面。 -->
&vhost-img.evhtech.cn;
&vhost-api.evhtech.cn;
&vhost-style.evhtech.cn;

 第2步,重启下试试。

重启Tomcat,会怎么样。报错,跟预期的一样。

第3步,

mkdir  -p  /data/www/api
  echo  Tomcat api page test > /data/www/api/index.html
mkdir  -p  /data/www/style
  echo  Tomcat style page test > /data/www/style/index.html
mkdir  -p  /data/www/img
  echo  Tomcat img page test > /data/www/img/index.html

第4步,

第5步,启动

看前面的几行,说什么,No rules found matching ,失败,走到这里不知道怎么走了。

我在想要不把,分出去,拿进来,在里面能不以行。再分出去。

19-Jan-2019 13:28:05.369 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Context'.
19-Jan-2019 13:28:05.371 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Valve'.
19-Jan-2019 13:28:05.371 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Valve'.
19-Jan-2019 13:28:05.371 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host'.
19-Jan-2019 13:28:05.372 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Context'.
19-Jan-2019 13:28:05.372 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Valve'.
19-Jan-2019 13:28:05.372 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Valve'.
19-Jan-2019 13:28:05.372 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host'.
19-Jan-2019 13:28:05.373 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Context'.
19-Jan-2019 13:28:05.373 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Valve'.
19-Jan-2019 13:28:05.373 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host/Valve'.
19-Jan-2019 13:28:05.385 WARNING [main] org.apache.tomcat.util.digester.Digester.endElement   No rules found matching 'Server/Service/Engine/Host/Host'.
19-Jan-2019 13:28:05.403 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.35
19-Jan-2019 13:28:05.403 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Nov 3 2018 17:39:20 UTC
19-Jan-2019 13:28:05.404 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.35.0
19-Jan-2019 13:28:05.404 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
19-Jan-2019 13:28:05.404 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-514.26.2.el7.x86_64
19-Jan-2019 13:28:05.404 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
19-Jan-2019 13:28:05.405 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/local/jdk1.8.0_151/jre
19-Jan-2019 13:28:05.405 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_151-b12
19-Jan-2019 13:28:05.405 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
19-Jan-2019 13:28:05.405 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/local/apache-tomcat-8.5.35
19-Jan-2019 13:28:05.405 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/apache-tomcat-8.5.35
19-Jan-2019 13:28:05.406 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
19-Jan-2019 13:28:05.406 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
19-Jan-2019 13:28:05.406 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
19-Jan-2019 13:28:05.406 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
19-Jan-2019 13:28:05.407 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
19-Jan-2019 13:28:05.407 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
19-Jan-2019 13:28:05.407 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
19-Jan-2019 13:28:05.407 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
19-Jan-2019 13:28:05.407 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
19-Jan-2019 13:28:05.436 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
19-Jan-2019 13:28:05.645 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
19-Jan-2019 13:28:05.688 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Jan-2019 13:28:05.711 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
19-Jan-2019 13:28:05.712 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Jan-2019 13:28:05.744 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1029 ms
19-Jan-2019 13:28:05.769 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
19-Jan-2019 13:28:05.769 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.35
19-Jan-2019 13:28:05.810 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.35/webapps/docs]
19-Jan-2019 13:30:31.326 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [145,067] milliseconds.
19-Jan-2019 13:30:31.355 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.35/webapps/docs] has finished in [145,545] ms
19-Jan-2019 13:30:31.355 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.35/webapps/manager]
19-Jan-2019 13:30:31.423 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.35/webapps/manager] has finished in [68] ms
19-Jan-2019 13:30:31.423 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.35/webapps/host-manager]
19-Jan-2019 13:30:31.463 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.35/webapps/host-manager] has finished in [40] ms
19-Jan-2019 13:30:31.464 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.35/webapps/ROOT]
19-Jan-2019 13:30:31.509 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.35/webapps/ROOT] has finished in [46] ms
19-Jan-2019 13:30:31.510 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.35/webapps/examples]
19-Jan-2019 13:30:31.940 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.35/webapps/examples] has finished in [429] ms
19-Jan-2019 13:30:31.971 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
19-Jan-2019 13:30:32.104 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
19-Jan-2019 13:30:32.106 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 146362 ms

第6步,

posted @ 2019-01-19 14:09  glpa  阅读(154)  评论(0编辑  收藏  举报