擴展
邱李的tomcat文檔 https://www.linuser.com/forum.php?mod=forumdisplay&fid=37
JAR、WAR包區別 http://blog.csdn.net/lishehe/article/details/41607725
tomcat常見配置彙總 http://blog.sina.com.cn/s/blog_4ab26bdd0100gwpk.html
resin安裝 http://fangniuwa.blog.51cto.com/10209030/1763488/
1 tomcat 單機多實例
http://www.ttlsa.com/tomcat/config-multi-tomcat-instance/
2 tomcat的jvm設置和鏈接數設置
http://www.cnblogs.com/bluestorm/archive/2013/04/23/3037392.html
3 jmx監控tomcat
http://blog.csdn.net/l1028386804/article/details/51547408
4 jvm性能調優監控工具jps/jstack/jmap/jhat/jstat
http://blog.csdn.net/wisgood/article/details/25343845
http://guafei.iteye.com/blog/1815222
5 gvm gc 相關
http://www.cnblogs.com/Mandylover/p/5208055.html
http://blog.csdn.net/yohoph/article/details/42041729
tomcat內存溢出
https://blog.csdn.net/ye1992/article/details/9344807php
Connector port="8080" protocol="HTTP/1.1"修改成Connector port="80" protocol="HTTP/1.1"
[root@yong-01 ~]# vim /usr/local/tomcat/conf/server.xml 搜索 /8080 這裏是控制監聽端口的,將這裏的 8080 改成 80 <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
[root@yong-01 ~]# /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@yong-01 ~]# /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@yong-01 ~]# netstat -lntp |grep java tcp6 0 0 :::80 :::* LISTEN 1808/java tcp6 0 0 127.0.0.1:8005 :::* LISTEN 1808/java tcp6 0 0 :::8009 :::* LISTEN 1808/java
<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@yong-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>
增長虛擬主機,編輯server.xml,在</Host>下面增長以下內容html
<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@yong-01 src]# wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war
[root@yong-01 src]# ls /usr/local/tomcat/webapps/ docs examples host-manager manager ROOT
[root@yong-01 src]# cp zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/ [root@yong-01 src]# ls /usr/local/tomcat/webapps/ docs examples host-manager manager ROOT zrlog-1.7.1-baaecb9-release zrlog-1.7.1-baaecb9-release.war
[root@yong-01 src]# cd /usr/local/tomcat/webapps/ [root@yong-01 webapps]# mv zrlog-1.7.1-baaecb9-release zrlog [root@yong-01 webapps]# ls docs examples host-manager manager ROOT zrlog zrlog-1.7.1-baaecb9-release.war [root@yong-01 webapps]# ls docs examples host-manager manager ROOT zrlog zrlog-1.7.1-baaecb9-release zrlog-1.7.1-baaecb9-release.war
而後去訪問,使用瀏覽器訪問IP,會看到安裝嚮導,其實就是一個配置數據庫的過程java
檢查mysql服務是否正常啓動mysql
[root@yong-01 webapps]# ps aux |grep mysql root 1255 0.0 0.0 115388 1688 ? S 6月27 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/yong-01.pid mysql 1408 0.1 24.2 1104396 454820 ? Sl 6月27 0:04 /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/yong-01.err --pid-file=/data/mysql/yong-01.pid --socket=/tmp/mysql.sock root 1983 0.0 0.0 112680 984 pts/0 S+ 00:06 0:00 grep --color=auto mysql
[root@yong-01 webapps]# mysql -uroot -p111111 mysql> create database zrlog; Query OK, 1 row affected (0.00 sec)
mysql> grant all on zrlog.* to 'zrlog'@127.0.0.1 identified by '123456'; Query OK, 0 rows affected (0.00 sec)
[root@yong-01 webapps]# mysql -uzrlog -h127.0.0.1 -p123456 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | test | | zrlog | +--------------------+ 3 rows in set (0.04 sec)
接下來就是在瀏覽器訪問IP打開的網頁,填寫數據庫的信息(系統信箱自定義便可),以後就能訪問了,密碼爲 123456nginx
admin 密碼 adminweb
正常訪問搭建的博客,並能夠在文章後臺發佈文章sql
<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@yong-01 webapps]# mkdir /data/wwwroot/123.cn/
[root@yong-01 webapps]# mv zrlog/* /data/wwwroot/123.cn/
192.168.202.130 www.123.cn
[root@yong-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@yong-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@yong-01 webapps]# netstat -lntp |grep 80 tcp 0 0 0.0.0.0:39580 0.0.0.0:* LISTEN - tcp6 0 0 :::80 :::* LISTEN 2127/java tcp6 0 0 127.0.0.1:8005 :::* LISTEN 2127/java tcp6 0 0 :::8009 :::* LISTEN 2127/java
[root@yong-01 webapps]# ls /usr/local/tomcat/logs/ catalina.2018-06-26.log host-manager.2018-06-28.log localhost_access_log.2018-06-28.txt catalina.2018-06-27.log localhost.2018-06-26.log manager.2018-06-26.log catalina.2018-06-28.log localhost.2018-06-27.log manager.2018-06-27.log catalina.out localhost.2018-06-28.log manager.2018-06-28.log host-manager.2018-06-26.log localhost_access_log.2018-06-26.txt host-manager.2018-06-27.log localhost_access_log.2018-06-27.txt [root@yong-01 webapps]#
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="123.cn_access" suffix=".log" pattern="%h %l %u %t "%r" %s %b" />