在瀏覽器訪問ip的默認端口爲80,tomcat的8080端口須要輸入。改成80更方便php
[root@ax-01 ~]# vim /usr/local/tomcat/conf/server.xml Connector port="8080"修改成Connector port="80" [root@ax-01 ~]# /usr/local/tomcat/bin/shutdown.sh [root@ax-01 ~]# /usr/local/tomcat/bin/startup.sh
[root@ax-01 ~]# vim /usr/local/tomcat/conf/server.xml
增長虛擬主機,編輯server.xml,在</Host>下面增長以下內容html
<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>
zrlog博客項目就是war包實現的,能夠體會appBase和docBase目錄的做用java
[root@ax-01 ~]# wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war [root@ax-01 ~]# mv zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/ [root@ax-01 ~]# mv /usr/local/tomcat/webapps/zrlog-1.7.1-baaecb9-release /usr/local/tomcat/webapps/zrlog
瀏覽器訪問 ip/zrlog/install/mysql
mysql下 create database zrlog; grant all on zrlog.* to 'zruser'@'127.0.0.1' identified by 'axianglinux';
按步驟安裝完成後linux
這裏的頁面是appbase裏的zrlog目錄下內容,因此有目錄路徑。將內容放入剛定義的虛擬主機的docbase再試試web
[root@ax-01 123.cn]# cd - /usr/local/tomcat/webapps [root@ax-01 webapps]# mv zrlog/* /data/wwwroot/123.cn/ [root@ax-01 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 Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar [root@ax-01 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 Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. [root@ax-01 webapps]# netstat -lntp | grep 80 tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 3097/java tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3097/java tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 3097/java
綁hosts而後ping下試試sql
能夠訪問apache
ls /usr/local/tomcat/logsbootstrap
具體方法是在對應虛擬主機的<Host></Host>裏面加入下面的配置(假如域名爲123.cn): <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="123.cn_access" suffix=".log" pattern="%h %l %u %t "%r" %s %b" />vim
擴展