参考网址:
http://www.linuxquestions.org/questions/showthread.php?t=429037
http://www.howtoforge.com/apache2_tomcat5_mod_jk_p1
1 Installing Apache2
下载apache
wget -c http://apache.mirror.phpchina.com/httpd/httpd-2.2.4.tar.bz2
解压缩后进入目录进行配置
./configure --enable-module=so --enable-module=usertrack --enable-modules=fastcgi --enable-info --enable-suexec --with-mpm=worker --enable-expires --enable-headers --enable-deflate --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache
make && make install
Edit /usr/local/apache2/conf/httpd.conf and change(修改apache2配置文件):
加入
DirectoryIndex index.htm index.html index.php index.xhtml index.shtml
/usr/local/apache2/bin/apachects start
启动apache2
2 Installing JDK (Java Development Kit) or JRE(Java Runtime Environment)
从
http://java.sun.com
下载 jdk 或 jre
chmod +x jre-6u4-linux-i586.bin
Now execute the file:
./jre-6u4-linux-i586.bin
mv jre1.6.0_04 /usr/local/
Now we need to set the JAVA_HOME environment variable. Add the following at the end of /etc/profile just after export PATH.
vi /root/.bashrc
加入
JAVA_HOME=/usr/local/jre1.6.0_04
PATH=$JAVA_HOME:$JAVA_HOME/bin:$PATH
#CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME PATH CLASSPATH
重新登陆系统后
echo $JAVA_HOME
就会打印JAVA_HOME
3 Installing Tomcat
http://tomcat.apache.org
下载tomcat
执行
tar xvzf apache-tomcat-6.0.14.tar.gz
进入
TOMCAT_HOME/bin/
执行./startup.sh
启动 进入 http://localhost:8080/ 就表示成功
4 Installing and configuring mod_jk
(1) cd /usr/src
(2) 首先下载(wget http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.15/jakarta-tomcat-connectors-1.2.15-src.tar.gz)
http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.15/jakarta-tomcat-connectors-1.2.15-src.tar.gz
(3) tar xvzf jakarta-tomcat-connectors-1.2.15-src.tar.gz
(4) cd jakarta-tomcat-connectors-1.2.15-src/jk/native
(5) Now you are ready to create the custom configure file for your system. Execute the following:
./buildconf.sh
如果提示失败,最好下载
autoconf,automake,libtool
This will create a configure file in the
/usr/src/jakarta-tomcat-connectors-1.2.15-src/jk/native directory.
(6) Execute the following command in order to configure mod_jk for your system.
Important note: You will need to have apxs2 (APache eXtension tool) installed and configured with Apache.
If you do not have it, as was my case, you can download and install the apache2-threaded-dev package
(which replaced the former apache-dev package) from www.debian.org.
At the time of this writing, the Debian package archive at www.debian.org was down and
they referred me to their temporary site until they resolved their issues pdo.debian.net.
I found the apache2-threaded-dev package and was able to install it successfully.
Be sure to include the correct location apxs2 on your system in the path of the command.
./configure --with-apxs=/usr/local/apache2/bin/apxs
(7) 执行make
在执行make 时可能会出现
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
make[1]: *** [jk_ajp12_worker.lo] Error 1
make[1]: Leaving directory `/usr/src/jakarta-tomcat-connectors-1.2.15-src/jk/native/common'
make: *** [all-recursive] Error 1
修改Makefile 和common/Makefile两个文件
找到
LIBTOOL = /usr/share/apr-1.0/build/libtool --silent
改为
LIBTOOL = /usr/share/apr-1.0/build/libtool --silent --tag CC
(8) make install 执行后应该在/usr/local/apache2/modules/可以看到mod_jk.so
5 Configuring Tomcat and Apache
Create the workers.properties file
Important note: Be sure to make a backup copy of your config files before modifying.
The workers.properties file contains the details about how each process is linked to Tomcat by defining workers that communicate through the ajpv13 protocol. Refer to the Workers HowTo for more detail.
1.First create the workers.properties file in your Apache2 root directory.
touch /usr/local/apache2/conf/workers.properties
2.Next, open the workers.properties file and add the following.
You can find many other examples of the workers.properties file on the internet,
but this is the one that I created and it seems to work fine with the other portions
that have already been configured in this tutorial.
在workers.properties加入以下内容:
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/jre1.6.0_01
ps=/
worker.list=worker1
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1
3 保存并关闭文件
4. Now we need to open the /usr/local/apache2/conf/httpd.conf file and add the following lines at the bottom.
(httpd.conf is just for backward compatibility)
在最后加入 以下内容
LoadModule jk_module /usr/local/apache2/modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /usr/local/apache2/conf/workers.properties
# Where to put jk logs
JkLogFile /var/log/apache2/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"
JkMount /*.jsp worker1
JkMount /*.do worker1
保存修改
(5) 修改
/usr/local/apache2/conf/extra/httpd-vhost.conf
修改,指定到应用程序中
DocumentRoot /var/www/test/
<Directory /var/www/test/>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
并把 Options Indexes FollowSymLinks MultiViews
改成 Options FollowSymLinks MultiViews
保存修改
(6) 重启 tomcat
然后 /usr/local/apache2/bin/apachectl restart
这样apache就会把jsp请求交给tomcat来处理了
分享到:
相关推荐
在本文中,我们将深入探讨jakarta-tomcat-connectors-1.2.15-src.tar.gz这个源码包,揭示其中包含的源代码、设计理念以及如何利用这些源码来理解Tomcat的工作原理。 首先,让我们了解一下Jakarta Tomcat Connectors...
【标题】"jakarta-tomcat-connectors-1.2.15-src.zip" 是一个包含Apache Tomcat连接器源代码的压缩包,主要用于帮助开发者深入理解Tomcat的工作原理,并进行自定义或扩展。 【描述】提到的"jakarta_tomcat_...
综上所述,"jakarta-tomcat-connectors-jk2.0.4-win32"是一个关键的中间件,它允许开发者和管理员将高性能的Apache Tomcat应用服务器与广泛使用的IIS Web服务器集成,以实现动态内容的处理。通过正确配置和使用这个...
标题中的"jakarta-tomcat-connectors-jk-1.2.6-src.tar.gz"是一个源码压缩包,其中包含了Jakarta Tomcat Connectors(JK)的版本1.2.6的源代码。Jakarta Tomcat Connectors是Apache Tomcat服务器的一部分,用于处理...
Jakarta Tomcat 5.0.28 是一个历史悠久但仍然具有重要参考价值的Java Web应用服务器,尤其对于学习和理解早期的Java EE(当时称为J2EE)环境的开发者而言。Tomcat作为Apache软件基金会的项目,是开源社区中的一个...
总之,“jakarta-tomcat-connectors-jk2-src-current.tar.gz”为开发者提供了深入了解和定制JK2的机会,对于构建高可用、高性能的Java Web应用环境具有重要意义。通过深入研究源码,开发者不仅可以解决特定问题,还...
1. **下载与安装**:首先,从Apache官方网站下载对应版本的jakarta-tomcat-connectors-jk2.0.2-win32-IIS.zip文件,解压后将isapi_redirect.dll和相关库文件拷贝到IIS的扩展目录。 2. **配置IIS**:在IIS管理工具中...
jakarta-tomcat-5.0.16.exejakarta-tomcat-5.0.16.exejakarta-tomcat-5.0.16.exe
这个压缩包"jakarta-tomcat-5.5.7-admin.zip"提供了Tomcat服务器的管理员接口,使得系统管理员能够更方便地管理他们的应用服务。 **Tomcat 5.5.7 特性** 1. **Servlet 2.4 和 JSP 2.0 支持**:Tomcat 5.5.7符合...
Jakarta Tomcat,由Apache软件基金会开发,是一个开源的、免费的应用服务器,它主要用于处理Java Servlets和JavaServer Pages (JSP)。Tomcat 5.0.28是这个系列的一个重要版本,提供了稳定性和性能上的优化,对于...
jakarta-tomcat-5.0.12.tar.gzjakarta-tomcat-5.0.12.tar.gzjakarta-tomcat-5.0.12.tar.gzjakarta-tomcat-5.0.12.tar.gz
【标题】"jakarta-tomcat-5.0.30.rar" 提供的是Apache Tomcat 5.0.30版本的服务器软件,这是一个基于Java的开源Web应用服务器,主要用于运行Servlet和JSP(JavaServer Pages)应用程序。Tomcat是Apache软件基金会...
【标题】:“jakarta-tomcat-5.0.28.exe”是一个针对Java应用程序的Web服务器和应用服务器,属于Apache Tomcat的5.0.28版本。Apache Tomcat是开源软件,它实现了Java Servlet和JavaServer Pages(JSP)规范,允许...
Jakarta Tomcat 4.0.1 是一个基于Apache软件基金会(ASF)的Jakarta项目中的关键组件,它是针对Java Servlet和JavaServer Pages(JSP)技术的开源Web应用服务器。作为一个轻量级的应用服务器,Tomcat在J2EE(现在...
linux安装jakarta-tomcat-4.1.30.tar.gz
jakarta-tomcat-5.5.11.exe
Apache和tomcat负载均衡需要的jar包
5. **连接器(Connector)**:Tomcat使用不同的连接器来处理HTTP、AJP(Apache JServ Protocol)和其他协议的请求。AJP连接器允许Tomcat与Apache HTTP服务器集成,提高性能。 6. **JNDI(Java Naming and Directory...
Tomcat 5.0.28的安装文件`jakarta-tomcat-5.0.28.exe`是Windows平台下的可执行程序,用于安装和配置该版本的Tomcat服务器。 以下是关于Jakarta Tomcat 5.0.28的一些关键知识点: 1. **架构与功能**:Tomcat作为...