Linux下安装Tomcat及融合Apache

类别:Java 点击:0 评论:0 推荐:

//设置变量

# vi ~/.bash_profile

//如下配置

JAVA_HOME=/opt/bea/jdk141_05

CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib

TOMCAT_HOME=/usr/local/tomcat

CATALINA_HOME=$TOMCAT_HOME

PATH=$PATH:$HOME/bin:$JAVA_HOME/jre/bin:$JAVA_HOME/bin

BASH_ENV=$HOME/.bashrc

USERNAME="root"

export USERNAME BASH_ENV PATH JAVA_HOME CLASSPATH CATALINA_HOME

//执行

# 。~/.bash_profile

//测试JAVA

# java –version

//启动tomcat

# $TOMCAT_HOME/bin/startup.sh

//融合Apache下载

http://apache.linuxforum.net/dist/jakarta/tomcat-4/v4.1.30/src/jakarta-tomcat-connectors

//需要安装httpd-devel包

//加入service

#!/bin/bash

#

# tomcat       Starts Tomcat Java server.

#

#

# chkconfig: 345 88 12

# description: Tomcat is the server for Java servlet applications.

### BEGIN INIT INFO

# Provides: $tomcat

### END INIT INFO

 

# Source function library.

. /etc/init.d/functions

 

[ -f /home/tomcat/tcstart.sh ] || exit 0

[ -f /home/tomcat/tcstop.sh ] || exit 0

 

RETVAL=0

 

umask 077

 

start() {

        echo -n $"Starting Tomcat Java server: "

        daemon su -c /home/tomcat/tcstart.sh tomcat

        echo

        return $RETVAL

}

stop() {

        echo -n $"Shutting down Tomcat Java server: "

        daemon su -c /home/tomcat/tcstop.sh tomcat

        echo

        return $RETVAL

}

restart() {

        stop

        start

}

case "$1" in

  start)

        start

        ;;

  stop)

        stop

        ;;

  restart|reload)

        restart

        ;;

  *)

        echo $"Usage: $0 {start|stop|restart}"

        exit 1

esac

 

exit $?

?????????????

# cd webapp

# ./support/buildconf.sh

# ./configure –with-apxs

# make

# cp apache-2.0/mod_webapp.so /usr/lib/httpd/modules/

# rm –rf 目录

//在conf.d目录下生成子配置文件webapp.conf

# vi webapp.conf

LoadModule webapp_module modules/mod_webapp.so

ServerName localhost:8008

WebAppConnection warpConnection warp localhost:8008

WebAppDeploy examples warpConnection /examples

//检测语法错误

# httpd –t

//配置tomcat

# vi $TOMCAT_HOME/conf/server.xml

 

  <Service name="Tomcat-Apache">

    <Connector className="org.apache.catalina.connector.warp.WarpConnector"

               port="8008" minProcessors="5" maxProcessors="75"

               enableLookups="true" appBase="webapps"

               acceptCount="10" debug="0"/>

    <Engine className="org.apache.catalina.connector.warp.WarpEngine" name="Apache" debug="0">

           <Logger className="org.apache.catalina.logger.FileLogger" prefix="apache_log." suffix=".txt"

                      timestamp="true"/>

              <Realm className="org.apache.catalina.realm.MemoryRealm"/>

       </Engine>

  </Service>

//重新启动服务.OK

如果有什么问题,请发邮件: [email protected]

本文地址:http://com.8s8s.com/it/it14691.htm