linux系统apache tomcat虚拟主机安装配置

系统 Linux
多年不用tomcat,应一朋友要求,搭建一个java环境的虚拟主机,经过多次测试,现在把可以正常运行的配置记录下来。

多年不用tomcat,应一朋友要求,搭建一个java环境的虚拟主机,经过多次测试,现在把可以正常运行的配置记录下来。

安装jdk

cd /usr/local

sh /mnt/mysql/jdk-6u14-linux-i586.bin

ln -s jdk1.6.0_14/ jdk

echo "export JAVA_HOME=/usr/local/jdk

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib" >> /etc/profile.d/java.sh

chmod +x /etc/profile.d/java.sh

安装tomcat

wget http://apache.freelamp.com/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz

tar xzf apache-tomcat-6.0.20.tar.gz -C /usr/local/

cd /usr/local/

ln -s apache-tomcat-6.0.20/ tomcat

vi ~/.bash_profile

TOMCAT_HOME=/usr/local/tomcat

export PATH TOMCAT_HOME

source ~/.bash_profile

安装jk connector

wget http://labs.xiaonei.com/apache-mirror/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz

tar xfz tomcat-connectors-1.2.28-src.tar.gz -C /usr/local/src/

cd /usr/local/src/tomcat-connectors-1.2.28-src/

cd native/

./configure –with-apxs=/usr/local/httpd/bin/apxs

make

cp apache-2.0/mod_jk.so /usr/local/httpd/modules/

apche配置

vim /usr/local/httpd/conf/extra/httpd-vhosts.conf

LoadModule jk_module modules/mod_jk.so

Include /usr/local/httpd/conf/mod_jk.conf

<VirtualHost *:80>

JkMountCopy On

ServerName edu.veryi.com

DirectoryIndex index.jsp index.html index.jsp index.htm

DocumentRoot /usr/local/tomcat/webapps/ROOT

#DocumentRoot /usr/local/www/edu.veryi.com/html

#<Directory /usr/local/www/edu.veryi.com>

<Directory /usr/local/tomcat/webapps/ROOT>

Order allow,deny

Allow from all

</Directory>

CustomLog "|/usr/local/sbin/cronolog /var/log/httpd/edu.veryi.com-access_log.%Y%m%d" combined

ErrorDocument 404 /missing.html

</VirtualHost>

 vim /usr/local/httpd/conf/mod_jk.conf

JkWorkersFile /usr/local/httpd/conf/workers.properties

# Where to put jk logs

JkLogFile /usr/local/httpd/logs/mod_jk.log

# Set the jk log level [debug/error/info]

JkLogLevel info

# Select the log format

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicate to send SSL KEY SIZE,

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format

JkRequestLogFormat "%w %V %T"

# servlet 和jsp请求通过ajp13的协议送给Tomcat

JkMount /servlet/* worker1

JkMount /*.jsp worker1

——————————

/usr/local/httpd/conf/workers.properties

# Defining a worker named worker1 and of type ajp13

worker.list=worker1

# Set properties for worker1

worker.worker1.type=ajp13

worker.worker1.host=localhost

worker.worker1.port=8009

#worker.worker1.lbfactor=50

#worker.worker1.socket_keepalive=1

#worker.worker1.socket_timeout=300

tomcat配置

vim /usr/local/tomcat/conf/server.xml

<Host name="edu.veryi.com"

unpackWARs="true" autoDeploy="true">    <Context path="" docBase="/usr/local/tomcat/webapps/ROOT" />        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

prefix="tomcat_access_log." suffix=".log" pattern="common" resolveHosts="false"/>        <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"

prefix="tomcat_file_log." suffix=".log" timestamp="true"/>

</Host>

【编辑推荐】

  1. 要你学会SuSE Linux操作系统下Apache虚拟网站设置
  2. 高效分析linux系统中配置Apache服务
  3. 最近10年及下个10年Apache最有影响的项目
责任编辑:赵宁宁 来源: chinaitlab
相关推荐

2010-01-11 11:19:28

Apache配置

2011-08-16 15:16:26

UbuntuApache虚拟主机

2014-06-09 10:40:05

Ubuntu 14.0虚拟主机

2010-03-02 13:35:59

Fedora apac

2010-03-29 16:17:07

Nginx虚拟主机

2017-08-15 15:24:21

2009-06-10 14:00:31

Jboss虚拟主机安装

2011-03-08 11:11:38

LinuxLAMP安装

2011-03-08 11:11:38

LinuxLAMP安装

2010-05-12 18:05:45

linux下subvesubversionapache配置

2010-03-25 19:23:51

Nginx配置虚拟主机

2010-07-01 13:35:51

vsftpd

2009-09-04 11:03:42

2013-04-02 11:21:52

Linux操作系统虚拟主机

2010-02-05 13:37:07

Ubuntu安装

2010-05-25 18:45:05

2010-01-14 13:47:30

CentOS extm

2011-03-30 15:05:41

MRTG流量图

2011-03-02 09:31:13

2011-03-02 09:31:13

点赞
收藏

51CTO技术栈公众号