您的位置:首页 > 运维架构 > Tomcat

linux下的tomcat安装与配置

2016-08-19 13:51 288 查看
当前使用版本:

    JDK:jdk-7u4-linux-x64.rpm

    Tomcat:apache-tomcat-7.0.27.tar.gz

    Centos 5.5 64位操作系统

1、将以下安装包拷贝至data0目录下

2、安装

    进入/data0

    执行rpm –ivh jdk-7u4-linux-x64.rpm  

    执行 tar zxvf apache-tomcat-7.0.27.tar.gz

         mv apache-tomcat-7.0.27 /usr/local/tomcat

3、配置

添加环境变量

    编辑文件/etc/profile

    在文件最后添加如下内容:

    export JAVA_HOME=/usr/java/jdk1.7.0_04

    export TOMCAT_HOME=/usr/local/tomcat

    保存退出   执行 source /etc/profile 使文件生效。

关闭防火墙

    chkconfig iptables off

    service iptables stop

启动tomcat

    将项目business拷贝至/usr/local/tomcat/webapps下

    编辑server.xml文件,添加

    <Context path="" docBase="/usr/local/tomcat/webapps/business" reloadable="true"/>

    保存退出。

    启动:/usr/local/tomcat/bin/startup.sh

    关闭:/usr/local/tomcat/bin/shutdown.sh

更改默认首页

    假如要更改的首页为loginFrm.html

    打开文件conf/web.xml,找到这段代码:

       <welcome-file-list> 
       <welcome-file>index.html</welcome-file> 
       <welcome-file>index.htm</welcome-file> 
       <welcome-file>index.jsp</welcome-file> 
       </welcome-file-list> 
    改成:
       <welcome-file-list> 
       <welcome-file>loginFrm.html</welcome-file> 
       <welcome-file>index.html</welcome-file> 
       <welcome-file>index.htm</welcome-file> 
       <welcome-file>index.jsp</welcome-file> 
       </welcome-file-list>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: