标签:配置tomcat监听端口 配置tomcat虚拟主机 tomcat日志配置
16.4 配置Tomcat监听80端口访问网站默认是80端口,如果是8080端口,就要访问时IP加端口,想要实现不加端口就可以访问网站,只需修改server.xml即可,配置如下:
#vim /usr/local/tomcat/conf/server.xml
Connector port="8080" protocal="HTTP/1.1"修改为Connector port="80" protocol="HTTP/1.1"
#/usr/local/tomcat/bin/shutdown.sh
#/usr/local/tomcat/bin/startup.sh
查看进行,#ps aux | grep java
查看监听端口,#!net
停止nginx,#/etc/init.d/nginx stop
#/usr/local/tomcat/bin/shutdown.sh
#/usr/local/tomcat/bin/startup.sh //8005端口启动慢,需要等待,启动后,开网页就快了;
16.5/16.6/16.7 配置Tomcat虚拟主机
#vim /usr/local/tomcat/conf/server.xml //在</Host>下面增加如下内容
<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>
#wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war //war包自动解压,删除war包,也会自动删除解压目录
#mv zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/
#mv /usr/local/tomcat/webapps/zrlog-1.7.1-baaecb9-release /usr/local/tomcat/webapps/zrlog
浏览器访问ip:8080/zrlog/install/
#mv /usr/local/tomcat/weapps/zrlog/* /data/wwwroot/123.cn/
设置数据库,用于填写上面信息
检查mysql是否启动,#ps aux | grep mysql
进入mysql,#mysql -uroot -paminglinux
mysql>create database zrlog;
mysql>grant all on zrlog.* to 'zrlog'@127.0.0.1 identified by 'aminglinux';
mysql>quit
#mysql -uzrlog -h127.0.0.1 -paminglinux
mysql>show databases;
mysql>quit
现在访问zrlog博客,需要浏览器访问ip:8080/zrlog/,若取消后面的/zrlog/,则进行以下操作;
#vim /usr/local/tomcat/conf/server.xml //看到docBase="/data/wwwroot/123.cn"
#mkdir /data/wwwroot/123.cn
#mv /usr/local/tomcat/webapps/zrlog/* /data/wwwroot/123.cn/
然后绑定hosts,
#/usr/local/tomcat/bin/shutdown.sh
#/usr/local/tomcat/bin/startup.sh
查看80,8009,8005端口是否启动,#!net
查看包含80字符的端口,#netstat -lntp | grep 80
访问网站www.123.cn
16.8 Tomcat日志
#ls /usr/local/tomcat/logs //有四类文件
配置日志
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
prefix="123.cn_access" suffix=".log"
pattern="%h %l %u %t "%r" %s %b" />
扩展
邱李的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安装 1 tomcat 单机多实例
2 tomcat的jvm设置和连接数设置
3 jmx监控tomcat
4 jvm性能调优监控工具5 gvm gc 相关
标签:配置tomcat监听端口 配置tomcat虚拟主机 tomcat日志配置
原文地址:http://blog.51cto.com/12059818/2116779