java > 正文

[phpStudy]Windows下Apache+Tomcat+jsp+php的服务器整合配置经验总结

一、先安装phpStudy
二、Tomcat和Apache的整合配置

mod_jk.so
详细的下载地址:http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/

注意:apche的版本必须与mod_jk-**.so的版本相同.主要就是不同版本使得配置麻烦,而且还没用!

1、在D:\phpStudy\PHPTutorial\Apache\modules文件夹中添加上面下载好的 mod_jk.so

2、在D:\phpStudy\PHPTutorial\Apache\logs 文件夹中添加mod_jk.log

3、在D:\phpStudy\PHPTutorial\Apache\conf\httpd.conf 文件中添加支持Tomcat模块

LoadModule proxy_module modules/mod_proxy.so
Include conf/mod_jk.conf 放在Include conf/vhosts.conf上面

4、在D:\phpStudy\PHPTutorial\Apache\conf里添加mod_jk.conf
 

#Load mod_jk module
LoadModule jk_module modules/mod_jk.so
#Where to find workers.properties
JkWorkersFile conf/workers.properties
#Where to put jk logs
JklogFile logs/mod_jk.log
#Set the jk log level[debug/error/info]
JkLogLevel info
#Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
#JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
#Send servlet for context /examples to worker named ajp13
JkMount /servlet/* ajp13
#Send all files under MyProject for to worker named ajp13
JKMount /wspy ajp13

 

5、D:\phpStudy\PHPTutorial\Apache\conf\vhosts.conf文件的最后添加

<VirtualHost *:80>
DocumentRoot D:\phpStudy\PHPTutorial\WWW
ServerName wspy.cyjwjc.gov.cn
 
DirectoryIndex index.php index.html index.html.var    
 
JkMount /*WEB-INF ajp13
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /*.do ajp13
JkMount /*.action ajp13
JkMount /wspy/* ajp13
</VirtualHost>
 

6、在D:\phpStudy\PHPTutorial\Apache\conf文件夹中添加workers.properties

 

workers.tomcat_home="d:\Java\Tomcat 8.5\"   #让mod_jk模块知道Tomcat的安装路径
workers.java_home="d:\Java\jdk1.8.0_65\"    #让mod_jk模块知道jdk路径
ps=\  #当前目录
worker.list=ajp13   #这里是关键,名字要和httpd.conf的一致。如果这里改了httpd.conf也要改。
worker.ajp13.port=8009   #工作端口,tomcat的jk监听端口,可以查看Server.xml中有port="8009"
worker.ajp13.host=localhost   #Tomcat所在机器,如果安装在与apache不同的机器则需要设置IP
worker.ajp13.type=ajp13   #协议类型,不能改变,会出问题
worker.ajp13.lbfactor=1   #负载平衡因子


 

欢迎关注微信公众号:ruitiancn;合作及投稿请联系:z_vae@sina.com

赞助商