Tomcat 集成 Apache

(内容为《Pro Tomcat》中的)

一 .通过Apache 转发

(1)conf/httpd.conf uncomment

LoadModule proxy_module libexec/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

add ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

(2) 修改server.xml

<Connector port=”8080″
maxThreads=”150″ connectionTimeout=”20000″
proxyName=”localhost” proxyPort=”80″/>

二.通过AJP Connector 即mod_jk 集成

(1)Create workers.properties in CATALINA_HOME/conf

# For Windows:
# Setting Tomcat & Java Home
workers.tomcat_home=”c:\jakarta-tomcat”
workers.java_home=”c:\jdk1.5″
ps=\
worker.list=worker1
# Settings for worker1 worker
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
# ———————–
# For Linux/Unix systems:
# Setting Tomcat & Java Home
workers.tomcat_home=/usr/java/jakarta-tomcat
workers.java_home=/usr/java/jdk1.5
ps=/
worker.list=worker1
# Settings for worker1 worker
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13

(2).add the code after <Server port=”8005″>

<Listener className=”org.apache.jk.config.ApacheConfig”
modJk=”C:/Program Files/Apache Group/Apache/modules/mod_jk.dll”
workersConfig=”C:/jakarta-tomcat/conf/workers.properties”
jkLog=”C:/jakarta-tomcat/logs/mod_jk.log”
jkDebug=”info”
/>

(3).and add another code in <Host></Host>

 <Listener className=”org.apache.jk.config.ApacheConfig”
append=”true”
jkWorker=”worker1″ />

(4).in httpd.conf add

Include “C:/jakarta-tomcat/conf/auto/mod_jk.conf”

你可能感兴趣的:(java,apache,tomcat,C++,C#)