IIS Tomcat Shared 80 port solution
- 2020-06-19 12:23:05
- OfStack
Why have this kind of demand, the reason is that the company has a Java web project, on the other server A, boss 1 rise recently, want to combine his B to the stable point one server, the server used IIS B to boarding asp. net website, what can we do, crustily skin of head, on the Internet to find all kinds of solutions:
Solution 1: isapi_redirect
This method has been tried N times but failed,
Solution 2: IIS reverse proxy
The basic logic is that the request comes to IIS, IIS forwards the request to Tomcat according to the routing rules, and tomcat returns the response to IIS,
This scenario is still just IIS monopolizing port 80, it looks as if IIS Tomcat shares port 80
Need to install a IIS plug-in download address below https: / / www microsoft. com web/handlers/webpi ashx/getinstaller/ARRv3_0 appids
The configuration files generated after the various configurations on IIS UI are as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="tomcat">
<match url="^(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.ahapc.org$" />
</conditions>
<action type="Rewrite" url="http://localhost:8080/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
^(.*), which means that all requests are matched,
www. ahapc. org represents an input match, meaning that if your request contains www. ahapc. org, the forward condition is met
http://localhost:8080/{R:1} means that after the above conditions are met, it is forwarded to local 8080 for processing, that is, to local Tomcat for processing
Solution 3: nginx reverse proxy
conclusion