找到一篇关于fedora16上架构Tomcat的Blog,索性转一下:
转自:http://blog.csdn.net/LibNux/article/details/7066624
-----------------------------------------------------------------------------
To integrate Tomcat 7.0.23 with Apache Http Server 2.2.21 using tomcat connector (mod_jk) 1.2.32
可以从httpd.apache.org下载安装,或者直接yum安装Fedora打包好的版本:sudo yum install httpd httpd-devel
从tomcat.apache.org下载安装
从http://tomcat.apache.org/download-connectors.cgi下载后缀为tar.gz的源代码,解压缩后编译安装:
$> tar zxvf tomcat-connectors-1.2.32-src.tar.gz -C .
$> cd native
$> ./configure --with-apxs=/usr/sbin/apxs (or where ever the apxs/apxs2 is)
$> make
$> su -c 'make install'
注意:如果启用了SELinux(Fedora一般默认启用),需要使用如下命令修改SELinux的设置),不然在浏览转向tomcat的页面(比如http://localhost/examples/)时,会得到 “Service Temporarily Unavailable"测错误信息,在mod_jk.log里面会发现类似"Failed opening socket to (127.0.0.1:8009) (errno=13)"的错误信息:
$> sudo chcon -u system_u -t httpd_modules_t /usr/lib/httpd/modules/mod_jk.so #这一步可选
$> sudo setsebool -P httpd_can_network_connect 1
$> cp tomcat-connectors-1.2.32-src/conf/httpd-jk.conf /etc/httpd/conf.d/
$> cp tomcat-connectors-1.2.32-src/conf/workers.properties.minimal /etc/httpd/conf/workers.properties
$> cp tomcat-connectors-1.2.32-src/conf/uriworkermap.properties /etc/httpd/conf/
修改/etc/httpd/conf/workers.properties,在"worker.ajp13w.type=ajp13"前面添加一行:worker.list=ajp13w
修改/etc/httpd/conf/uriworkermap.properties,把wlb全部替换为ajp13w
修改 /etc/httpd/conf.d/httpd-jk.conf,把"# JkMountFile conf/extra/uriworkermap.properties"替换为"JkMountFile conf/uriworkermap.properties"
$> sudo /sbin/service httpd restart
$> sudo /path/to/tomcat/bin/startup.sh #也可以用普通用户启动,如果需要设置tomcat所在目录的写权限
然后浏览器输入http://localhost/examples/测试(注意examples后面有/)