我在整个互联网上都找遍了,但找不到任何适合我的解决方案,这让我抓狂。
我尝试使用 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/
[...]
有人可以帮帮我吗?
最佳答案
确保在您的配置中 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>
代理通行证
The ProxyPass directive specifies the mapping of incoming requests to the backend server
ProxyPassReverse
To ensure that and Location: headers generated from the backend are modified to point to the reverse proxy, instead of back to itself, the ProxyPassReverse directive is most often required
关于Apache2反向代理首次安装永远加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41026963/