简体   繁体   English

端口80中的Apache请求重定向到8080的tomcat

[英]Apache request in port 80 redirect to tomcat at 8080

I have successfully pointed Apache http request to point to tomcat 8080. but the issue is the images and css are not getting loaded. 我已经成功指出Apache http请求指向tomcat8080。但是问题是图像和CSS没有被加载。 It still is looking at port 80. The application is hosted in amazon ec2 My tomcat deployed url : 它仍然在查看端口80。该应用程序托管在Amazon ec2中。

If I type www.abc.com it successfully redirect to my application and shows the welcome page. 如果输入www.abc.com,它将成功重定向到我的应用程序并显示欢迎页面。 but the images are not showing. 但图像未显示。 If I include port 8080 in the url the image are showing. 如果我在网址中包含端口8080,则显示图像。 eg: 例如:

www.abc.com:8080/WebApplication/img/xy.jpg

server.xml
 <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />


Config of httpd.conf in apache
<IfModule mod_proxy.c>
ProxyRequests Off
#<Proxy *>
#    Order deny,allow
#    Deny from all
#    Allow from .example.co
ProxyPass / http://www.sabc.com:8080/WebApplication1/
ProxyPass /WebApplication1/img www.abc.com:8080/WebApplication1/img
ProxyPass /WebApplication1/css www.abc.com:8080/WebApplication1/css


ProxyPassReverse /WebApplication1/css www.abc.com:8080/WebApplication1/css
ProxyPass /WebApplication1/img www.abc.com:8080/WebApplication1/img
ProxyPassReverse  / www.abc.com:8080/WebApplication1/
#</Proxy>

First thing is you shouldn't be required to mention ProxyPass settings if you already have below code. 第一件事是,如果您已经有以下代码,则无需要求提及ProxyPass设置。

ProxyPass         /   http://www.sabc.com:8080/WebApplication1/
ProxyPassReverse  /   http://www.sabc.com:8080/WebApplication1/

Still if there is any requirement to specifically mention it, it seems that code written needs to be rectified for ProxyPass Reverse for images as below. 仍然有任何需要特别提及的要求,看来为图像的ProxyPass Reverse需要纠正编写的代码,如下所示。

ProxyPass /WebApplication1/img               http://www.sabc.com:8080/WebApplication1/img
ProxyPass /WebApplication1/css               http://www.sabc.com:8080/WebApplication1/css
ProxyPass***Reverse*** /WebApplication1/img  http://www.sabc.com:8080/WebApplication1/img
ProxyPassReverse /WebApplication1/css        http://www.sabc.com:8080/WebApplication1/css

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

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