阿帕奇+代理 + tomcat:错误 - 应用程序名称重复
我已经配置了一个 apache 2.2 服务器来将请求转发到监听 8080/tcp 的 tomcat 6 应用程序。当 apache 处理请求时,它会复制应用程序的名称。因此,浏览器上会出现错误。 Apache 和 tomcat 位于防火墙后面的同一服务器上。在防火墙上,我创建了一个重定向规则,将所有 80/tcp 请求转发到 apache 服务器。 8080 tcp 端口被防火墙阻止。
这是我的 apache 2.2 配置:
<VirtualHost *:80>
ServerName myaddress.com
ServerAlias myaddress.com
ServerAdmin [email protected]
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
Order allow,deny
Allow from all
ProxyPass http://localhost:8080/portal
ProxyPassReverse http://localhost:8080/portal
</Location>
</VirtualHost>
这是我的 server.xml 配置:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" proxyPort="80" proxyName="myaddress.com"/>
当我在浏览器中,地址被替换为 http://myaddress.com/portal 并显示以下错误消息:
<强>HTTP 状态 404 - /portalportal/
类型状态报告
消息 /portalportal/
描述 请求的资源 (/portalportal/) 不可用。
I have configured an apache 2.2 server to forward requests to a tomcat 6 application listen on 8080/tcp. When the request is processed by apache, it duplicates the name of the application. So an error is posted on the browser.
Apache and tomcat are living at the same server, behind a firewall. On the firewall, I have created a redirect rule to forward all 80/tcp requisitions to apache´s server. 8080 tcp port is blocked on firewall.
Here is my apache 2.2 config:
<VirtualHost *:80>
ServerName myaddress.com
ServerAlias myaddress.com
ServerAdmin [email protected]
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
Order allow,deny
Allow from all
ProxyPass http://localhost:8080/portal
ProxyPassReverse http://localhost:8080/portal
</Location>
</VirtualHost>
Here is my server.xml config:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" proxyPort="80" proxyName="myaddress.com"/>
When I type http://myaddress.com in the browser, the address is replaced by http://myaddress.com/portal and the following error message is showed:
HTTP Status 404 - /portalportal/
type Status report
message /portalportal/
description The requested resource (/portalportal/) is not available.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它应该看起来像:
“/”意味着应该从 http://localhost -> 访问它。代理至-> http://localhost:8080/portal。
It should look like:
the "/" means it should be accessed from http://localhost -> proxied to -> http://localhost:8080/portal.
相反,您可以使用workers 将 tomcat 连接到 apache,这样您就不必处理端口 8080,而只需处理 apache 端口。一个很好的来源是 http://www3.ntu.edu.sg /home/ehchua/programming/howto/ApachePlusTomcat_HowTo.html
您还可以找到更多指南。因此,您将拥有带有所需路径的 JKmount 以及您的工作人员名称
JkMount /path worker1
例如希望我没有误解您的问题,并希望它有所帮助!
Instead of this you can connect tomcat to apache using workers so that you never have to deal with port 8080, only the apache ones. A good source is http://www3.ntu.edu.sg/home/ehchua/programming/howto/ApachePlusTomcat_HowTo.html
and there are many more guides you can find. So you will have JKmount with the desired path along with your worker name
JkMount /path worker1
for exampleHope I didn't misunderstand your question, and hope it helps!