首页 > 代码库 > win32+ apache2.2 + tomcat7配置

win32+ apache2.2 + tomcat7配置

首先已安装了apache2.2.22与tomcat7,并下载了相应的连接器文件mod_jk.so,存放于apache目录的modules下。
我的电脑的安装路径如下:
1、D:\server\Apache2.2
2、D:\server\tomcat7
3、在D:\server\Apache2.2\conf下新建文件workers.properties并添加内容如下

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009


4、然后编辑D:\server\Apache2.2\conf\httpd.conf文件,编辑时做好备份,在最后添加如下内容

#apache+tomcat config start
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkMount /*.do worker1
JkMount /*.jsp worker1

#apache+tomcat config end

5.(可选)配置虚拟目录,httpd.conf中添加 

Alias /qrcodes "d:/Qrcodes"
<Directory "d:/Qrcodes">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /images "d:/WebImages"
<Directory "d:/WebImages">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /apks "d:/Apks"
<Directory "d:/Apks">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

 

最后
并找到DocumentRoot "D:/server/Apache2.2/htdocs"改行修改为DocumentRoot "D:/server/tomcat7/webapps/ROOT";找到<Directory "D:/server/Apache2.2/htdocs">修改为<Directory "D:/server/tomcat7/webapps/ROOT">
5、然后启动tomcat与apache服务,输入http://localhost即可看到tomcat管理界面。

 

备注:httpd.conf 中,可以配置apache默认首页

<IfModule dir_module>
DirectoryIndex index.do index.html
</IfModule>