dev*_*cky 6 http-proxy mod-proxy node.js apache-2.4
如何修复 apache2“proxy_http:error”AH01102: 从远程服务器 localhost:4382 读取状态行时出错。
我有一个 apache2 Web 服务器,用于在后端为一些 Nodejs 应用程序提供服务。
Apache2网络服务器版本:服务器版本:Apache/2.4.41(Ubuntu)服务器构建:2019-08-21T20:43:05
Nodejs版本:v10.18.1
蒙戈数据库版本:v4.0.15
我们在所有后端应用程序“proxy_http:错误”AH01102:从远程服务器本地主机读取状态行时出错:4382 上都受到以下错误/错误(请参阅日志)的困扰。
[Mon Apr 27 20:09:05.697271 2020] [proxy_http:error] [pid 26792:tid 140063099688704] (70007)The timeout specified has expired: [client 178.153.198.97:52385] AH01095: prefetch request body failed to 127.0.0.1:4381 (localhost) from 178.153.198.97 (), referer: https://www.example.com/sub-admin/menus/add-menu
[Mon Apr 27 20:21:51.617095 2020] [proxy_http:error] [pid 26764:tid 140062901626624] (104)Connection reset by peer: [client 178.153.195.206:61268] AH01102: error reading status line from remote server localhost:4382, referer: http://www.example.com/restaurant/dashboard
[Mon Apr 27 20:21:51.617117 2020] [proxy:error] [pid 26764:tid 140062901626624] [client 178.153.195.206:61268] AH00898: Error reading from remote server returned by /restaurant/assets/img/avatars/5.jpg, referer: http://www.example.com/restaurant/dashboard
[Tue Apr 28 03:51:28.498423 2020] [proxy_http:error] [pid 26793:tid 140062868055808] (104)Connection reset by peer: [client 89.211.117.185:57622] AH01102: error reading status line from remote server localhost:4382, referer: http://www.example.com/restaurant/dashboard
[Tue Apr 28 03:51:28.498455 2020] [proxy:error] [pid 26793:tid 140062868055808] [client 89.211.117.185:57622] AH00898: Error reading from remote server returned by /restaurant/static/css/main.f8d32764.chunk.css, referer: http://www.example.com/restaurant/dashboard
Run Code Online (Sandbox Code Playgroud)
到目前为止,我已经尝试了这些方法来修复此错误。
ProxyPreserveHost On - 它没有发挥作用。
禁用重用=打开。它不起作用。
超时=600,然后超时=900。没用。
重试=1 获取=3000 超时=600 保持活动=打开。没用。
SetEnv 强制-代理-请求-1.0 1
SetEnv 代理-nokeepalive 1
工作时间较短(12 小时)。同样的错误再次以与之前几乎相同的频率重现。
这个工作了24小时。然后24小时后,这个错误又重现了。虽然这次已经过了 24 小时,但错误每小时只发生一次,有时两小时一次,有时两到五小时一次。
1Q。首先,为什么会发生这个错误。
2Q。这个错误是否仅仅因为apache或nodejs应用程序而发生也可能是罪魁祸首
(但是当这个apache错误发生时,几乎没有任何应用程序的错误日志)。
3Q。如何/什么是识别、诊断和解决此错误的最佳方法,因为在各种论坛上进行搜索后,似乎没有人能够完美地解决此错误或为其提供正确的答案,自 2006 年以来一直是这种情况,寻找在一些论坛上。
这是我的 apache 配置文件
<VirtualHost *:443>
ServerAdmin root@example.com
ServerName www.example.com
ServerAlias example.com
SSLEngine On
SSLProxyEngine On
SSLCertificateFile "/etc/ssl/private/server.crt"
SSLCertificateKeyFile "/etc/ssl/private/server.key"
ProxyRequests Off
#Admin
ProxyPass /admin http://localhost:4380/
ProxyPassReverse /admin http://localhost:4380/
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
ProxyPass /restaurant http://localhost:4382/
ProxyPassReverse /restaurant http://localhost:4382/
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
ProxyPass /sub-admin http://localhost:4385/
ProxyPassReverse /sub-admin http://localhost:4385/
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
#API
ProxyPass /admin-api/ http://localhost:4381/
ProxyPassReverse /admin-api/ http://localhost:4381/
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
ProxyPass /restaurant-api/ http://localhost:4379/
ProxyPassReverse /restaurant-api/ http://localhost:4379/
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
小智 3
如果您查看日志,首先会出现(70007)指定的超时已过期:[client 178.153.198.97:52385] AH01095日志的其余部分是其结果。
这里发生的情况是您的本地主机实现需要很长时间才能返回答案。也许您可以在实现中验证原因并尝试优化它。但在 apache 中,您可以定义等待 localhost 实现的连接时间和超时
ProxyPass /restaurant http://localhost:4382/ connectiontimeout= [时间(以秒为单位)] timeout= [时间(以秒为单位)[
例如 60 秒(1 分钟)
ProxyPass /餐厅 http://localhost:4382/ 连接超时=60 超时=60
归档时间: |
|
查看次数: |
56588 次 |
最近记录: |