网站地图    收藏   

主页 > 后端 > 网站安全 >

Windows2003下Tomcat5.5 整合IIS6 - Windows操作系统 - 自学

来源:自学PHP网    时间:2015-04-17 18:33 作者: 阅读:

[导读] 环境:Windows 2003 R2 + IIS 6.0 + JDK 1.5+TOMCAT5.51. 安装tomcat2. 下载jkhttp://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.14/isapi_redirect-1.2.14.exe 安装的好处就是配置文件都有了...

环境:Windows 2003 R2 + IIS 6.0 + JDK 1.5+TOMCAT5.5

1. 安装tomcat

2. 下载jk

http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.14/isapi_redirect-1.2.14.exe

安装的好处就是配置文件都有了。只需做少许修改:

安装目录可以随意(最好让目录不带空格),安装完成后在conf里就是它的配置文件,安装完后找到目录文件Apache Software FoundationJakarta Isapi Redirector 这个可以根据你自己的改动,在conf文件里把workers.properties.minimal它改为

workers.properties,对应找到注册表里的

HKEY_LOCAL_MACHINESOFTWAREApache Software FoundationJakarta Isapi Redirector1.0] 中的worker_file 点右键修改

同样去掉workers.properties.minimal 后的minimal。

3. 以下为两个文件的内容

uriworkermap.properties:

# Mapping the URI /admin, /manager, /jsp-examples and /servlets-examples and

# everything under them to Tomcat

# /admin/*=ajp3

# /manager/*=ajp13

# /jsp-examples/*=ajp13

# /servlets-examples/*=ajp13

# Mapping all URI which end with a common suffix .jsp and .do to Tomcat

# /*.jsp=ajp13

# /*.do=ajp13

# Mapping all URI to Tomcat

/*=ajp13

worker.properties:

worker.list=ajp13

worker.ajp13.type=ajp13

worker.ajp13.host=localhost

worker.ajp13.port=8009

4. 在iis里新建一个站点,指向网站所在的目录(比如$CATALINA_HOMEwebappsROOT),然后在站点上点右键选“属性”,在弹出的页框里选择“ISAPI筛选器”,点“添加”,筛选器名称填jakarta,可执行文件中填入你的isapi_redirector.dll的绝对路径。“确定”后点“确定”关闭属性页。再在“默认网站”上右键,选择“新建”->“虚拟目录”,别名填jakarta,下一步,路径选为你的isapi_redirector.dll存放的目录。

5. 在“Internet信息服务管理器”的“网站”中的“Web服务扩展”上点右键选择“添加一个新的Web服务扩展”,弹出的框中扩展名填Tomcat(其实无所谓的),“要求的文件”选“添加”然后找到你的isapi_redirector.dll后“确定”。“设置扩展状态为允许”也打上勾,确定。

6. 如果要让iis能读取index.jsp这样的jsp默认首页,还需要在IIS6.0右键单击【默认网站】,选择【属性】,单击【主目录】选项卡中的【配置】,单击【映射】选项卡,单击【添加】,将isapi_redirector.dll的全路径写进去,扩展名要写.jsp(注意:如果你的路径包含空格,那么你需要将这个完整路径用英文的双引号括起来才能添加)。

到这里就配置完了

7. 重起tomcat 重启iis 去掉端口后看看能运行了吧

总结:

说到底,这就是两种服务的一种集成,使之外部看起来像一种服务,可以这么理解:

外部访问域名-->解析后到IP-->IIS查找相应站点-->发现jsp文件-->转至jk连接处理-->将相应文件解释转给Tomcat-->将页面返回给IIS-->展现给客户端。

那么哪出了问题,就查哪,一步一步来,一定能成功的,希望对大家有所帮助,另外多看官方手册,多想其中的原理,网上流传的各种文档不一定就是正确的,包括本文,只是尽量详尽的给一种引导。

System Requirements

For this installation I used the following:

Windows Server 2003 Enterprise Edition

Internet Information Services (IIS) 6.0

Sun Java Runtime JRE 5.0 Update 2

Apache Jakarta Tomcat version 5.5.9

The JK Tomcat Web Server Connectors

1. Install the JDK and Tomcat and set the environment variable.

2. Configure JK

Download JK from http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.14/isapi_redirect-1.2.14.exe

Setup the file. (It’s better that there isn’t blank space in the directory which you choose to install.)

After installing it, you could find the file “workers.properties.minimal” in Apache Software FoundationJakarta Isapi Redirector, and change its name to “workers.properties”.

Open the Registry Editor; Open the “HKEY_LOCAL_MACHINESOFTWAREApache Software FoundationJakarta Isapi Redirector1.0]”

Change the value “workers.properties.minimal”of worker_file to “workers.properties”

The content of worker.properties and uriworkermap.properties is follow:

worker.properties:

worker.list=ajp13

worker.ajp13.type=ajp13

worker.ajp13.host=localhost

worker.ajp13.port=8009

uriworkermap.properties:

# Mapping the URI /admin, /manager, /jsp-examples and /servlets-examples and

# everything under them to Tomcat

# /admin/*=ajp3

# /manager/*=ajp13

# /jsp-examples/*=ajp13

# /servlets-examples/*=ajp13

# Mapping all URI which end with a common suffix .jsp and .do to Tomcat

# /*.jsp=ajp13

# /*.do=ajp13

# Mapping all URI to Tomcat

/*=ajp13


3. Create a new website in IIS which point to your website (such as $CATALINA_HOME webappsROOT)


4. Configure the Tomcat ISAPI Filter

Rigth click your websiteàPropertiesàISAPI FiltersàAddàset Filter name “jakarta” and Executable choose the path of “isapi_redirector.dll”àOK

Note – If you check on its status, you may notice that the ISAPI filter hasn’t been successfully loaded at this stage, even if you have re-started IIS. This is expected behaviour and is documented in the IIS6 Operations Guide,

“In an effort to optimize resources in IIS 6.0, an ISAPI filter is not loaded until a request is made to a Web site that requires the ISAPI filter. Until this request is made, IIS Manager does not display the status of the ISAPI filter.”

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/93f23233-2a47-4104-b0b4-a7ec0d3116f3.mspx

However, once IIS has served a successful request to it you will see the status of the ISAPI filter change to ‘Loaded’.


5. Create a virtual directory for the Tomcat connector to use, create a new Web Service Extension in IIS and then enable that web service extension so that it can be used.

Rigth click your websiteàNewàVirtual Directoryàset Alias: jakartaàNextàset Path: choose the path of “isapi_redirector.dll”.

6. Create and exable the tomcat Web Service Extension

Rigth click “Web Service Extension” à Add a new Web service extension àSet name: Tomcat, set Required files:choose your “isapi_redirector.dll”à click the “Set extension status to Allowed”àOK

7. Add the “.jsp”

Rigth click your websiteàPropertiesàHome DirectoryàMappingsàAddàset Executable: choose your “isapi_redirector.dll”, set Extension: .jsp (Note: if there is blank space in your path, you need to make your path in Double quotes.)

8. Set index.jsp as default content page

Rigth click your websiteàPropertiesàDocumentàAdd–>index.jsp

10. Restart tomcat and IIS. You should now be ready to test your Tomcat installation by issuing a request to the sample applications. Visit http://localhost

If show the page as http://localhost:8080, you’re successful.

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论