<Host name="www.123.cn" appBase=""
unpackWARs= "true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/data/wwwroot/123.cn/" debug="0" reloadable="true" crossContext="true"/>
</Host>
[root@hf-01 ~]# vim /usr/local/tomcat/conf/server.xml
搜索 /<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 "%r" %s %b" /> //日志相关
</Host>
<Host name="www.123.cn" appBase=""
##域名为www.123.cn,appbase后为空,就不会于docBase相互干扰
unpackWARs= "true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/data/wwwroot/123.cn/" debug="0" reloadable="true" crossContext="true"/>
## 自定义站点路径,不使用自动安装war的方式
</Host>
保存退出
[root@hf-01 ~]# cd /usr/local/src
[root@hf-01 src]# wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war
[root@hf-01 src]# ls /usr/local/tomcat/webapps/
docs examples host-manager manager ROOT
[root@hf-01 src]#
[root@hf-01 src]# cp zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/
[root@hf-01 src]# ls /usr/local/tomcat/webapps/
docs host-manager manager zrlog-1.7.1-baaecb9-release
examples logs ROOT zrlog-1.7.1-baaecb9-release.war
[root@hf-01 src]#
[root@hf-01 src]# cd /usr/local/tomcat/webapps/
[root@hf-01 webapps]# mv zrlog-1.7.1-baaecb9-release zrlog
[root@hf-01 webapps]# ls
docs host-manager manager zrlog
examples logs ROOT zrlog-1.7.1-baaecb9-release.war
[root@hf-01 webapps]# ls
docs logs zrlog
examples manager zrlog-1.7.1-baaecb9-release
host-manager ROOT zrlog-1.7.1-baaecb9-release.war
[root@hf-01 webapps]#
[root@hf-01 webapps]# ps aux |grep mysql
root 1313 0.0 0.1 115388 1680 ? S 1月21 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/hf-01.pid
mysql 1653 0.0 45.1 1039104 456604 ? Sl 1月21 0:20 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/hf-01.err --pid-file=/data/mysql/hf-01.pid
root 4744 0.0 0.0 112676 984 pts/0 R+ 06:16 0:00 grep --color=auto mysql
[root@hf-01 webapps]#
[root@hf-01 webapps]# mysql -uroot -phanfeng
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zrlog;
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> grant all on zrlog.* to 'zrlog'@127.0.0.1 identified by 'hanfeng1';
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[root@hf-01 webapps]# mysql -uzrlog -h127.0.0.1 -phanfeng1
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| zrlog |
+--------------------+
3 rows in set (0.01 sec)
mysql>
<Host name="www.123.cn" appBase=""
##域名为www.123.cn,appbase后为空,就不会于docBase相互干扰
unpackWARs= "true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/data/wwwroot/123.cn/" debug="0" reloadable="true" crossContext="true"/>
## 自定义站点路径,不使用自动安装war的方式
</Host>
[root@hanfeng webapps]# mkdir /data/wwwroot/123.cn/
[root@hanfeng webapps]#
[root@hanfeng webapps]# mv /usr/local/tomcat/webapps/zrlog/* /data/wwwroot/123.cn/
[root@hanfeng webapps]#
192.168.202.130 www.123.cn
[root@hanfeng webapps]# /usr/local/tomcat/bin/shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@hanfeng webapps]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@hanfeng webapps]#
[root@hanfeng webapps]# netstat -lntp |grep 80
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 3484/java
tcp6 0 0 :::8009 :::* LISTEN 3484/java
tcp6 0 0 :::80 :::* LISTEN 3484/java
[root@hanfeng webapps]#