Apache 反向代理至 Node-连接被拒绝:AH00957

Apache 反向代理至 Node-连接被拒绝:AH00957

我正在尝试获取一个全新的基于云的服务器,使用默认版本 20.04 服务器 ubuntu 与 apache 和节点一起工作。节点服务器似乎正在运行,没有问题报告 4006 端口已打开。但是我相信我的 apache 配置不是。请求将挂起很长时间。节点终端中没有显示任何错误。

我已经使用以下命令确认节点端的一切都是正确的,该命令从 apache 返回完整的 json 对象:

// Works as expected and returns results correctly 
curl -H 'Content-Type: application/json' -X POST <json>'  -H "Host: https://<https_url>.com" http://127.0.0.1:4006/graphql

一段时间后请求错误

502 proxy error

Apache 错误日志

[Sun Oct 17 20:58:56.608793 2021] [proxy:error] [pid 1596878] (111)Connection refused: AH00957: HTTP: attempt to connect to [::1]:4006 (localhost) failed
[Sun Oct 17 20:58:56.608909 2021] [proxy_http:error] [pid 1596878] [client 207.46.13.93:27392] AH01114: HTTP: failed to make connection to backend: localhost

虚拟主机

<VirtualHost <Server Ip Address>:80>
    ServerName api.aDomain.com
    Redirect permanent / https://api.aDomain.com/
</VirtualHost>
<IfModule mod_ssl.c>
    <VirtualHost <Server Ip Address>:443>
        ServerName api.aDomain.com

        ProxyRequests on
        LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
        LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so

        ProxyPass / http://localhost:4006/
        ProxyPassReverse / http://localhost:4006/
    

        #certificates SSL
        SSLEngine on
        SSLCACertificateFile /etc/ssl/api.aDomain.com/apimini.ca
        SSLCertificateFile /etc/ssl/api.aDomain.com/apimini.crt
        SSLCertificateKeyFile /etc/ssl/api.aDomain.com/apimini.key

        ErrorLog ${APACHE_LOG_DIR}/error_api.aDomain.com.log
        CustomLog ${APACHE_LOG_DIR}/access_api.aDomain.com.log combined

    </VirtualHost>
</IfModule>

终端输出

[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `babel-node -r dotenv/config --inspect=9229 index.js`
Debugger listening on ws://127.0.0.1:9229/c1fcf271-aea8-47ff-910e-fe5a91fce6d2
For help, see: https://nodejs.org/en/docs/inspector
Browserslist: caniuse-lite is outdated. Please run next command `npm update`

相关内容