Search code examples
deploymenttomcat9iis-10knowage

How to Deploy a Tomcat 9 Application Using Microsoft IIS 10?


I am looking for guidance on deploying a Tomcat 9 application (Knowage) using Microsoft Internet Information Services (IIS) version 10 on a Windows server. I can assess the application locally using http:\\localhost:8080\knowage but I can't reach it outside the server. My goal is to have IIS act as a reverse proxy for Tomcat, allowing me to route incoming HTTP requests to my Tomcat-based web application.

I have already installed both Tomcat 9 and IIS 10 on the server,I am currently hosting a php based application, some asp.net mvc and one asp.net webform application on the IIS. I have followed the Apache tomcat Connectors (Web Server HowTo) guide but my currently existing applications on IIS fell off and I still couldn't reach the tomcat application outside the server. I have aslo tried some other suggested steps like using a server farm but that brought down other applications too. I'm now unsure of the specific steps and configurations required to achieve this setup. Can someone provide a step-by-step guide or point me in the right direction to set up this configuration?

Additionally, if there are any best practices or considerations I should be aware of when deploying a Tomcat9 application with IIS, please share those as well.

Thank you for your assistance!


Solution

  • IIS was chosen because Tomcat typically runs on Windows servers, which provides an "all-in-one" solution. Other methods may work better in other situations.

    I won't discuss the Tomcat setup here, but assume it is running on the same system as the reverse proxy and listening on port 8080, and that port 80 is free.

    You need to set up a reverse proxy on IIS, but before that you need to install the URL rewriting module and application request routing.

    After installing the required software, proceed as follows.

    • Open IIS Manager.
    • Select your server in the Connections pane on the left.
    • In the center pane, double-click Application Request Route Cache.
    • Click "Server Proxy Settings" on the right.
    • Check the "Enable proxy" box and click "Apply".

    Then go to Default Website (port 80) and select URL Rewrite, then Add Rule. If your port 80 is occupied, you can also choose another port. Here I just take port 80 as an example.

    1. Select Reverse Proxy as the rule template and click OK.

    enter image description here

    1. In the Edit Inbound Rules window, enter the backend server URL, which is your Tomcat application URL (localhost:8080).

    enter image description here

    1. The rule should end up looking like: (the rule can be adjusted based on your actual situation)

    enter image description here

    At this point, the IIS reverse proxy tomcat has been set up and configured. You can test it.