Apache2反向代理首先安装加载永远

时间:2016-12-07 20:39:53

标签: apache tomcat apache2

我看了整个互联网,我找不到任何适合我的解决方案,这让我发疯。

我尝试使用Tomcat8和Apache2配置服务器。 所以我已经安装了Tomcat8(它正在工作),现在我的Apache有问题(它正在工作)。

但是现在我正在尝试从apache2到我的Tomcat8进行反向代理。

所以我配置了这个文件:/etc/apache2/sites-available/www.bloombooking.ca.conf

<VirtualHost *:80>
       ServerName www.bloombooking.ca
       ProxyPreserveHost On
       ProxyRequests On
       ProxyPass / http://144.217.85.74/
       ProxyPassReverse / http://144.217.85.74:8080
</VirtualHost>

但是当我尝试访问我的网址时,它会永远加载,我收到此消息:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: Error reading from remote server

我查看了日志,这是我得到的:

[Wed Dec 07 15:36:26.302595 2016] [proxy_http:error] [pid 18024:tid 139855795246848] (70007)The timeout specified has expired: [client 144.217.85.74:41866] AH01102: error reading status line from remote server 144.217.85.74:80
[Wed Dec 07 15:36:26.302604 2016] [proxy:error] [pid 18024:tid 139855795246848] [client 144.217.85.74:41866] AH00898: Error reading from remote server returned by /
[Wed Dec 07 15:36:26.302762 2016] [proxy_http:error] [pid 18024:tid 139855803639552] (70007)The timeout specified has expired: [client 144.217.85.74:41867] AH01102: error reading status line from remote server 144.217.85.74:80, referer: http://www.bloombooking.ca/
[Wed Dec 07 15:36:26.302781 2016] [proxy:error] [pid 18024:tid 139855803639552] [client 144.217.85.74:41867] AH00898: Error reading from remote server returned by /favicon.ico, referer: http://www.bloombooking.ca/
[...]

有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:2)

确保在配置中端口对齐ProxyPass和ProxyPassReverse

<VirtualHost *:80>
       ServerName www.bloombooking.ca
       ProxyPreserveHost On
       ProxyRequests On
       ProxyPass "/" "http://an.ip.add.res:8080/"
       ProxyPassReverse "/" "http://an.ip.add.res:8080/"
</VirtualHost>

的ProxyPass

  

ProxyPass指令指定传入请求到后端服务器的映射

ProxyPassReverse

  

要确保将后端生成的Location和Location:标头修改为指向反向代理,而不是返回自身,最常需要ProxyPassReverse指令