Apache无法连接PM2托管的Node.js进程问题求助
Apache无法连接PM2托管的Node.js进程问题求助
各位大佬好,我在Ubuntu 20上部署了Apache,最近一直遇到连接错误,在/var/log/apache2/error.log里看到如下日志:
[proxy:error] [pid 7064] (111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:4000 (127.0.0.1) failed [proxy_http:error] [pid 7064] [client ...] AH01114: HTTP: failed to make connection to backend: 127.0.0.1
我的虚拟主机配置是这样的:
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin me@example.com ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/example.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on # Reverse Proxy Stuff for Node ProxyPreserveHost On ProxyPass / http://127.0.0.1:4000/ Keepalive=On ProxyPassReverse / http://127.0.0.1:4000/ Keepalive=On SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule>
我在网站目录/var/www/example.com下用PM2启动了Node.js应用,命令是:pm2 start index.js -p 4000
执行pm2 status显示进程是在线状态,而且PM2日志里也没有任何错误,但Apache和PM2就是没法正常通信。
用netstat -tulpn检查后发现,根本没有进程在监听4000端口,我实在找不到问题出在哪了,有没有大佬能给点思路?
备注:内容来源于stack exchange,提问作者Clifton Labrum
相关产品推荐
相关产品推荐

