如何修复Apache Proxy获取503不可用的服务?

时间:2018-11-15 14:46:28

标签: proxy reverse-proxy apache2.4

我的情况是,我属于两个域:https://m.xxx.com(公共访问权)和作为https://m-backend.xxx.com(java码头服务器)(内部访问权)的后端API服务

我有Apache2(2.4)服务作为代理服务,虚拟主机位于下面

    <VirtualHost *:80>
        ServerAdmin intl.ops@xxx.com
        ServerName m.xxx.com
    ServerAlias prod-m.xxx.com
        RedirectMatch ^/(.*)$ https://m.xxx.com/$1
</VirtualHost>
<VirtualHost *:443>
        ServerAdmin intl.ops@xxx.com
        ServerName m.xxx.com
        ServerAlias prod-m.xxx.com

        ProxyPreserveHost On
        RequestHeader set Host "m.xxx.com"

        SSLProxyVerify none
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerName off
        SSLProxyEngine on
        ProxyPass /  https://m-backend.xxx.com/
        ProxyPassReverse / https://m-backend.xxx.com/

        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/xxx.com.crt
        SSLCertificateKeyFile /etc/ssl/private/xxx.com.key

        LogLevel error
        ErrorLog /var/log/apache2/xxx-m_error.log
        CustomLog /var/log/apache2/xxx-m_access.log combined
</VirtualHost>

在此配置下,站点和后端保持非常平稳的运行1或2年。但是,最近我们发现并发现该问题是503服务无法使用3或4次,并且该问题有时会重复出现。

我们检查了以下错误日志

[Thu Nov 15 10:22:56.517024 2018] [proxy:error] [pid 11252:tid 140252391913216] AH00959: ap_proxy_connect_backend disabling worker for (m-backend.xxx.com) for 0s
[Thu Nov 15 10:22:56.517032 2018] [proxy_http:error] [pid 11252:tid 140252391913216] [client 193.11.200.249:46357] AH01114: HTTP: failed to make connection to backend: pm-backend.xxx.com
[Thu Nov 15 10:22:57.662128 2018] [proxy:error] [pid 11253:tid 140252341556992] (70007)The timeout specified has expired: AH00957: HTTPS: attempt to connect to 34.242.163.141:443 (m-backend.xxx.com) failed
[Thu Nov 15 10:22:57.662168 2018] [proxy:error] [pid 11253:tid 140252341556992] AH00959: ap_proxy_connect_backend disabling worker for (m-backend.xxx.com) for 0s
[Thu Nov 15 10:22:57.662175 2018] [proxy_http:error] [pid 11253:tid 140252341556992] [client 194.74.173.218:60433] AH01114: HTTP: failed to make connection to backend: pm-backend.xxx.com
[Thu Nov 15 10:23:03.017035 2018] [proxy:error] [pid 11252:tid 140252349949696] (70007)The timeout specified has expired: AH00957: HTTPS: attempt to connect to 34.240.24.82:443 (m-backend.xxx.com) failed
[Thu Nov 15 10:23:03.017086 2018] [proxy_http:error] [pid 11252:tid 140252349949696] [client 95.97.251.194:54317] AH01114: HTTP: failed to make connection to backend: pm-backend.xxx.com, referer: https://m.xxx.com/
[Thu Nov 15 10:23:07.579491 2018] [proxy:error] [pid 11253:tid 140252282808064] (70007)The timeout specified has expired: AH00957: HTTPS: attempt to connect to 34.242.163.141:443 (m-backend.xxx.com) failed
[Thu Nov 15 10:23:07.579538 2018] [proxy_http:error] [pid 11253:tid 140252282808064] [client 193.11.200.249:40446] AH01114: HTTP: failed to make connection to backend: pm-backend.xxx.com
[Thu Nov 15 10:24:07.022485 2018] [proxy:error] [pid 11252:tid 140252291200768] (70007)The timeout specified has expired: AH00957: HTTPS: attempt to connect to 34.240.24.82:443 (m-backend.xxx.com) failed
[Thu Nov 15 10:24:07.022518 2018] [proxy:error] [pid 11252:tid 140252291200768] AH00959: ap_proxy_connect_backend disabling worker for (m-backend.xxx.com) for 0s
[Thu Nov 15 10:24:07.022525 2018] [proxy_http:error] [pid 11252:tid 140252291200768] [client 31.149.207.58:65004] AH01114: HTTP: failed to make connection to backend: m-backend.xxx.com
[Thu Nov 15 10:24:15.072698 2018] [proxy:error] [pid 11252:tid 140252358342400] (70007)The timeout specified has expired: AH00957: HTTPS: attempt to connect to 34.240.24.82:443 (m-backend.xxx.com) failed
[Thu Nov 15 10:24:15.072746 2018] [proxy_http:error] [pid 11252:tid 140252358342400] [client 66.249.64.220:42054] AH01114: HTTP: failed to make connection to backend: pm-backend.xxx.com

我检查了m-backennd.xxx.com工作正常。网站https://m.xxx.com有时可以正常工作(但响应速度非常慢),有时返回503。

我还尝试了使用 wget https://m.xxx.com 在服务器内部进行的工作,效果非常好 但是当我在服务器 wget https://m.xxx.com 外部尝试时,有时它的运行速度非常慢,并且大多数时候我们收到的503服务不可用。

要解决此问题,我只是重新加载了apache2服务(/etc/init.d/apache2重新加载)作为临时解决方案,该服务以正常状态运行。但是,只要我们达到503,并且需要重新加载服务,这不是正确的解决方案。

任何想法如何将其修复为永久解决方案,以及根本原因是什么?还是我的配置不正确?

0 个答案:

没有答案