IIS Tomcat shares port 80 and port iistomcat80
Why is there such a demand,
The reason is,
The company has A Java web project. On another server A, the boss has recently emerged and wants to merge it into server B of this stable point, server B uses IIS to host the asp.net website,
What should we do? Stick to your head and find various solutions on the Internet:
- Solution 1: isapi_redirect
I tried this method N times, but I did not solve it,
- Solution 2: IIS reverse proxy
The basic logic is that the request comes to IIS. IIS forwards the request to Tomcat Based on the routing rules, and then tomcat returns the response to IIS,
This solution still exclusive IIS port 80, it seems that it is IIS Tomcat sharing port 80
The following https://www.microsoft.com/web/handlers/webpi.ashx/getinstaller/ARRv3_0.appids needs to install an IIS plug-in:
The configuration files generated after various configurations on the 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>
^ (. *) Indicates that the regular expression matches all requests,
Www.ahapc.org indicates that the input matches, that is, if your request contains www.ahapc.org, the forwarding conditions are met.
Http: // localhost: 8080/{R: 1} indicates that the above conditions are met and then forwarded to the local 8080 for processing, that is, to the local Tomcat for processing.
- Solution 3: nginx reverse proxy