Apache 整合Tomcat
2016-03-10 21:29
567 查看
版本 tomcat8 + apache2.4
首先需要从官网上下载apache版本所对应的mod_jk.so 文件放在apache的modules目录下面
然后在conf目录下面建立两个文件为workers.properties和mod_jk.conf
workers.properties内容:
mod_jk.conf
删除 conf\extra\httpd-vhosts.conf 中的内容
添加如下内容
Include conf/mod_jk.conf
<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
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 webmaster@dummy-host.example.com
DocumentRoot "D:\www\huajie"
ServerName huajiepm.com
ServerAlias www.huajiepm.com
ErrorLog "logs/huajiepm-error_log"
CustomLog "logs/huajiepm-access_log" common
</VirtualHost>
www.huajiepm.com 为php项目
www.microdatainfo.com 为Java项目
修改 tomcat中 server.xml 中的
参考资料 :http://blog.csdn.net/catoop/article/details/47974773
首先需要从官网上下载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
mod_jk.conf
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 webmaster@dummy-host.example.com
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 webmaster@dummy-host.example.com
DocumentRoot "D:\www\huajie"
ServerName huajiepm.com
ServerAlias www.huajiepm.com
ErrorLog "logs/huajiepm-error_log"
CustomLog "logs/huajiepm-access_log" common
</VirtualHost>
www.huajiepm.com 为php项目
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>
参考资料 :http://blog.csdn.net/catoop/article/details/47974773
相关文章推荐
- 一次Tomcat6.0.33版本与6.0.44版本差异所引发的问题
- linux下tomcat端口被占用
- Tomcat类分析-Lifecycle
- centos6安装tomcat7
- windows+php5.5+apache2.4+tomcat+mod_jk配置
- S2SM项目tomcat启动停在Initializing Spring root WebApplicationContext
- 在centos中安装tomcat6
- Tomcat安装、配置、优化及负载均衡详解
- 2.window安装Jenkins和tomcat
- 修改Tomcat默认编码格式
- 修改tomcat 配置文件解决乱码
- class卸载、热替换和Tomcat的热部署的分析
- window环境Nginx+Tomcat集群配置
- Hadoop分析tomcat访问日志
- linux 安装jdk tomcat
- 并行类加载——让tomcat玩转双十一
- 图文解说:Nginx+tomcat配置集群负载均衡(转)
- 使用 CAS 在 Tomcat 中实现单点登录
- jvm 类加载器 和 tomcat类加载器
- Apache/Tomcat/JBOSS/Nginx区别