【问题标题】:Apache2 reverse proxy first install loading foreverApache2反向代理首次安装加载永远
【发布时间】:2017-04-22 22:58:39
【问题描述】:

我浏览了整个互联网,但找不到任何适合我的解决方案,这让我抓狂。

我尝试使用 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>

但是当我尝试访问我的 URL 时,它会永远加载并且我收到这条消息:

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/
[...]

有人可以帮我吗?

【问题讨论】:

    标签: apache tomcat apache2


    【解决方案1】:

    确保在您的配置中端口与 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 指令指定传入请求到后端服务器的映射

    ProxyPassReverse

    为了确保和 Location: 从后端生成的标头被修改为指向反向代理,而不是返回到自身,ProxyPassReverse 指令通常是必需的

    【讨论】:

    • 就是这样!从昨天开始我就被困住了,我搜索了大约 5~6 个小时,你终于救了我。非常感谢,真的。
    猜你喜欢
    • 2015-05-28
    • 1970-01-01
    • 1970-01-01
    • 2016-11-03
    • 2021-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多