IIS reverse proxy to Apache, Tomcat

Source: Internet
Author: User

Directory

    • Environment
    • Tools
    • Demand
    • Tutorial
      • Reverse Proxy

The IIS reverse proxy can rewrite the requested URL to a different URL to achieve the purpose of forwarding. Typically used for a server that only allows port 80, and 80 is used by IIS, you need to set up URL rewriting in IIS to forward requests to the specified IP:端口 or URL

Environment

Windowserver IIS7

Apache integrated in Wampserver

Tomcat

Test program: Micro-engine (PHP), a management system (Java)

Tools

Application Request Routing (arr x64) (arr x32)

URL Rewrite (x64 x32)

Demand

The server allows only 80 ports to be opened, requiring IIS to reverse proxy to other servers, allowing access to the APACHE/TOMCAT service through a level two domain name.

Suppose an environment: IIS is turned on in the server, the first-level domain name (test.com) can be accessed to the default site of IIS, but I am running PHP on Apache. So you want to access Apache Services (127.0.0.1:808) through a two-level domain name (a.test.com), accessing Tomcat (127.0.0.1:8080) through a two-level domain name (b.test.com)

Tutorial Reverse Proxy

1. Before using the reverse proxy, we need to install the ARR tool and URL Rewrite in IIS.

The installation method is simple, just open the links above the two tools to download them and install them.

2. But there is another shortcut to install the channel, Microsoft Official has a called Web Platform Installer can be installed directly with one click.

However, using the Web Platform Installer I encountered a problem where the interface was not able to enter the installer interface until the loading process. So if you can't load it, use the first method.

After the installation is complete, you can see that there are two features ( Application Routing Request ,) when you open IIS URL 重写

3. Open the Application Request Routing selectionServer Proxy Settings

4. Tick Enable proxy . Exit after Point app

5. Specify a site for URL rewriting

If you need to enter URL rewriting on a.test.com, click URL Rewriting feature in a.test.com site

6. 添加规则 - 入站规则 -空白规则

7. Add a configuration

    • Name Optional
    • Mode Write^(.*)
    • Add condition-Conditional input {HTTP_HOST} mode input^a.test.com$
    • Action Type Default override
    • Rewrite URL: http://127.0.0.1:808/{R:1} , this link represents the address to jump to, if you need to jump to tomcat, you can change the port to 8080

8. Once saved, you can access the a.test.com directly in the browser

Summarize

    • If you need to reverse proxy tomcat, just write the URL rewrite address as a link to Tomcat.
    • When I use Wampserver's micro-test program, I can rewrite to Apache, but when I submit login, there will be no login, but the server directly access Apache login and can log in. The reason is PHP的代码验证问题 . This way to modify the source file, or you do not use IIS URL Rewrite, directly in IIS to configure a PHP request mapping, in IIS to run PHP

IIS reverse proxy to Apache, Tomcat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.