简体   繁体   English

Apache反向代理问题

[英]Apache Reverse Proxy Issue

I am trying to user mod_proxy to set up the reverse proxy for multiple web application using a single Apache web server (version 2.4). 我正在尝试使用mod_proxy用户使用单个Apache Web服务器(版本2.4)为多个Web应用程序设置反向代理。

I have two applications running on two different tomcat servers: 我在两个不同的tomcat服务器上运行两个应用程序:

1. http://app.test.com:8080/app
2. http://app.test.com:8090/app

I have enabled the required modules in the httpd.conf file and added the below lines to the same: 我已经在httpd.conf文件中启用了所需的模块,并将以下几行添加到相同的位置:

> ProxyPass /App1/ http://app.test.com:8080/app
> ProxyPassReverse /App2/ http://app.test.com:8090/app

The issue is when I test this using below URL 问题是当我使用下面的URL测试时

http://rp.test.com:80/App1/ and http://rp.test.com:80/App2/ ,the apache webserver does send me to the apps hosted on tomcats but gives a 404 error on clicking any internal link of the application. http://rp.test.com:80/App1/ and http://rp.test.com:80/App2/网络服务器确实将我发送到了tomcats上托管的应用程序,但单击任何一个都给出了404错误应用程序的内部链接。

Think I am missing some configuration part here. 认为我在这里缺少一些配置部分。 Any suggestions? 有什么建议么?

You also need to configure Tomcat connectors behind the proxy. 您还需要在代理后面配置Tomcat连接器。 Somethink like this, containing your external server name and port. 这样的想法,包含您的外部服务器名称和端口。

<Connector port="8081" ...
          proxyName="www.mycompany.com"
          proxyPort="80"/>

To adjust the path in the URL, you may use the proxypassreversepath directive, see: 要调整URL中的路径,可以使用proxypassreversepath指令,请参阅:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreversecookiepath http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreversecookiepath

ProxyPassReverseCookiePath /App1/ /app/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM