Deploy Tomcat 8 on Windows 2012 Server and use IIS 8 as Frontend


This document explains how to set up the IIS to cooperate with Tomcat and access tomcat website via IIS.

Normally IIS cannot execute Servlets and Java Server Pages (JSPs), configuring IIS to use the HttpPlatformHandler will let IIS send servlet and JSP requests to Tomcat (and this way, serve them to clients).

Deploy Tomcat 8 on Windows 2012 Server and use IIS 8 as Frontend

Pre-requisites:

• IIS 8 or 8.5
• OS: Windows Server 2012 R2 64 bit
• HttpPlatformHandler (IIS Extension)
o The HttpPlatformHandler is an IIS Module, for IIS 8+, which does the following two things:
o Process management of http listeners – this could be any process that can listen on a port for http requests. For example – Tomcat, Jetty, Node.exe, Ruby etc;
o Proxy requests to the process that it manages.
• Tomcat 8.0.32 Distribution
• Java Development Kit (JDK1.8.0_121)

Step 1: Install IIS Web Server Role on the server.

Deploy Tomcat 8 on Windows 2012 Server and use IIS 8 as Frontend

Step 2: Download and Install the HttpPlatformHandler from below link.

http://download.microsoft.com/download/0/2/C/02CF3C6A-2ED8-43D3-9779-6376EBB80E8A/httpPlatformHandler_amd64.msi

Step 3: Download Tomcat 8

Go to the URL http://tomcat.apache.org/download-80.cgi and download the zipped package to any of your choice directory, let’s say “C:\MySite”. Once you download the zip file, you can extract into the same location “C:\MySite\Tomcat8”. (No need to install tomcat service. We just need tomcat distribution.)

Step 4: Download and Install Java Development Kit

Go to URL http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and download Java development kit 8 for windows and install JDK under “C:\MySite\Java\JDK1.8.0_121”

Step 5: Creating Environmental Variables for Windows

A. Create an Environmental Variable called CATALINA_HOME with value as your Tomcat directory. In my case CATALINA_HOME= C:\MySite\Tomcat8.
B. Create an Environment Variable called JAVA_HOME and set the value to the JDK installed directory. In my case JAVA_HOME=C:\MySite\Java\JDK1.8.0_121.

Step 6: Configure Apache Tomcat Server

There are few configuration changes required to setup Tomcat server and in our case we will be changing below files under %CATALINA_HOME%\Conf:

• Server.xml
• Web.xml
• Context.xml

A. Open server.xml under %CATALINA_HOME%\conf and change the settings as high lightened in yellow:

<Connector port=”${port.http}” protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″ />

B. Open web.xml under %CATALINA_HOME%\conf and change the settings as high lightened:

<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

C: Open context.xml under %CATALINA_HOME%\conf and change the settings as high lightened:

<Context reloadable=”true”>

Step 7: Configure IIS

A. Create a website and complete the site as below settings:

Deploy Tomcat 8 on Windows 2012 Server and use IIS 8 as Frontend

B. Create a web.config under your website folder which is C:\MySite\web.config and add the httpPlatformHandler configuration as below.

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<handlers>
<add name=”httpplatformhandler” path=”*” verb=”*” modules=”httpPlatformHandler” resourceType=”Unspecified” />
</handlers>
<httpPlatform processPath=”C:\MySite\Tomcat8\bin\startup.bat” arguments=”” stdoutLogEnabled=”true” stdoutLogFile=”\\?c:\MySite\log.txt”>
<environmentVariables>
<environmentVariable name=”JRE_HOME” value=”C:\MySite\Java\JDK1.8.0_121″ />
<environmentVariable name=”CATALINA_HOME” value=”C:\MySite\Tomcat8″ />
<environmentVariable name=”CATALINA_OPTS” value=”-Dport.http=%HTTP_PLATFORM_PORT%” />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>

• processPath – set to the patch to the location of startup.bat in your Tomcat folder
• stdoutLogEnabled – set to True to enable logging
• stdoutLogFile – Path where to write the log file
• EnvironmentVariables collection
      o JRE_HOME – Path to Java install on the machine
      o CATALINA_HOME – Path to Tomcat Folder

C: Set Handler Mappings to “Read/Write” under Feature Delegation.

Deploy Tomcat 8 on Windows 2012 Server and use IIS 8 as Frontend

Now open a browser and browse http://localhost which should show the default Tomcat server’s welcome page.

Deploy Tomcat 8 on Windows 2012 Server and use IIS 8 as Frontend


<<Click here to see all posts>>

If you found any of the information on this page helpful in anyway then please consider sharing this content with your favorite social network or by leaving your thoughts in the comment section. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove You Are Human Time limit is exhausted. Please reload CAPTCHA.