日期:2014-05-16 浏览次数:20692 次
1.在/etc/httpd/httpd.conf文件中添加,其中mod_jk.so要对应appache的版本.appache2.2.6对应mod_jk-1.2.27-httpd-2.2.6.so,见附件:
LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
?JkWorkersFile "/etc/httpd/workers.properties"
?JkLogFile "/usr/local/apache/logs/mod_jk.log"
</IfModule>
2.把mod_jk.so添加到apache/modules文件夹中
3.在/etc/httpd文件中添加workers.properties文件,内容如下:
ps=/
worker.list=tomcat
worker.tomcat.port=8888
worker.tomcat.host=localhost
worker.tomcat.type=ajp13
4.配置tomcat中的server.xml文件,如下:
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8014" shutdown="SHUTDOWN">
?<Service name="Catalina">
??<Connector port="8888" maxThreads="5000" minSpareThreads="500" maxSpareThreads="1500"
????? acceptCount="10000" connectionTimeout="60000" enableLookups="false" debug="1"
????? protocol="AJP/1.3" URIEncoding="UTF-8"? />
??<Engine name="Catalina" defaultHost="localhost">
???<Host name="localhost" appBase="" xmlValidation="false" xmlNamespaceAware="false" unpackWARs="true" autoDeploy="true">
????<Context path="/" docBase="/usr/tomcat6/webapps/exhibition" />
???</Host>
??</Engine>
?</Service>
</Server>
5.在/etc/httpd/extra/httpd-vhosts.conf中添加虚拟主机:
<VirtualHost *:80>
??? DocumentRoot "/usr/tomcat6/webapps/exhibition"
??? ServerName?? www.myexhibition.com
??? JkMount? /*? tomcat
</VirtualHost>
6.在/etc/httpd/httpd.conf中引入httpd-vhosts.conf文件,去掉httpd.conf中的httpd-vhosts.conf?前面的#注释即可:
Include /etc/httpd/extra/httpd-vhosts.conf?
?