<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]#
而後去訪問,使用瀏覽器訪問IP,會看到安裝嚮導,其實就是一個配置數據庫的過程html
檢查mysql服務是否正常啓動java
[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>
接下來就是在瀏覽器訪問IP打開的網頁,填寫數據庫的信息(系統信箱自定義便可),以後就能訪問了,密碼爲 hanfnegmysql
正常訪問搭建的博客,並能夠在文章後臺發佈文章nginx
<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]#