码迷,mamicode.com
首页 > 其他好文 > 详细

配置Tomcat

时间:2016-12-07 14:46:56      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:tomcat

1、安装jdk

wget http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.tar.gz    //下载jdk
tar zxvf jdk-8u65-linux-x64.tar.gz      //解压
mv jdk1.8.0_65/ /usr/local/
vim /etc/profile
JAVA_HOME=/usr/local/jdk1.8.0_65/
JAVA_BIN=/usr/local/jdk1.8.0_65/bin
JRE_HOME=/usr/local/jdk1.8.0_65/jre
PATH=$PATH:/usr/local/jdk1.8.0_65/bin:/usr/local/jdk1.8.0_65/jre/bin
CLASSPATH=/usr/local/jdk1.8.0_65/jre/lib:/usr/local/jdk1.8.0_65/lib:/usr/local/jdk1.8.0_65/jre/lib/charsets.jar
export  JAVA_HOME JAVA_BIN JRE_HOME PATH CLASSPATH
source /etc/profile
java -version

2、安装Tomcat

wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz      //下载tomcat
tar zxvf apache-tomcat-8.0.28.tar.gz
mv apache-tomcat-8.0.28 /usr/local/tomcat
cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
vim /etc/init.d/tomcat
#chkconfig: 112 63 37
#description: tomcat server init script
#Source Function Library
. /etc/init.d/functions
JAVA_HOME=/usr/local/jdk1.8.0_65/
CATALINA_HOME=/usr/local/tomcat
chmod 755 /etc/init.d/tomcat
chkconfig --add tomcat
chkconfig tomcat on
service tomcat start      //启动tomcat
ps aux |grep tomcat       //查看是否启动成功
http://192.168.0.133:8080/      //浏览器输入此地址会打开Tomcat主界面


3、配置Tomcat

Tomcat默认的端口为8080,如果要修改默认端口则需修改文件:/usr/local/tomcat/conf/server.xml,保存文件后重启Tomcat:service tomcat stop,service tomcat start(#此脚本不支持restart)


4、配置新的虚拟主机

cd /usr/local/tomcat/conf/
vim server.xml
<Host name="localhost"  appBase="/data/tomcatweb"
        unpackWARs="false" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
        <Context path="" docBase="./" debug="0" reloadable="true" crossContext="true"/>
    </Host>
service tomcat stop
service tomcat start


配置Tomcat

标签:tomcat

原文地址:http://chenjunru.blog.51cto.com/5698966/1880237

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!