版本 tomcat8 + apache2.4
首先需要从官网上下载apache版本所对应的mod_jk.so 文件放在apache的modules目录下面
然后在conf目录下面建立两个文件为workers.properties和mod_jk.conf
workers.properties内容:
workers.tomcat_home="D:/IDE/apache-tomcat-8.0.14" workers.java_home="D:/IDE/JDK8" worker.list=worker1 worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=1
LoadModule jk_module modules/mod_jk.so JkWorkersFile conf/workers.properties #JkLogFile logs/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" JkOptions +ForwardKeySize +ForwardURICompatUnparsed +ForwardDirectories JkRequestLogFormat "%w %V %T"
删除 conf\extra\httpd-vhosts.conf 中的内容
添加如下内容
Include conf/mod_jk.conf <VirtualHost *:80> #ServerAdmin [email protected] DocumentRoot "D:/www/franchisee_model" ServerName microdatainfo.com ServerAlias www.microdatainfo.com ErrorLog "logs/microdatainfo-error_log" CustomLog "logs/microdatainfo-access_log" common <IfModule mod_jk.c> #日志输出文件(其他配置也可以重写mod_jk.conf里面的配置) JkLogFile logs/mod_jk_microdatainfo.log #指URL指向如果有servlet,则让worker1去处理 JkMount /servlet/* worker1 #指URL为/*.jsp的页面,让worker1去处理 JkMount /*.jsp worker1 #指URL为/*.do的页面,让worker1去处理 JkMount /*.do worker1 #指URL为/*.json的页面,让worker1去处理 #JkMount /*.json worker1 JkMount /* worker1 </IfModule> <Directory "D:/www/franchisee_model"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> DirectoryIndex index.jsp index.html </VirtualHost> <VirtualHost *:80> #ServerAdmin [email protected] DocumentRoot "D:\www\huajie" ServerName huajiepm.com ServerAlias www.huajiepm.com ErrorLog "logs/huajiepm-error_log" CustomLog "logs/huajiepm-access_log" common </VirtualHost>
www.microdatainfo.com 为Java项目
修改 tomcat中 server.xml 中的
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="D:\www\franchisee_model" reloadable="true" distributable="true"/> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host>