Apache no puede ver el proceso del nodo PM2

Apache no puede ver el proceso del nodo PM2

Tengo Apache ejecutándose en Ubuntu 20 y sigo recibiendo este error en /var/logs/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

Mi host virtual está configurado así:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin [email protected]
    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>

En mi directorio web ( /var/www/example.com) inicié mi aplicación con pm2 así:

pm2 start index.js -p 4000

Cuando lo hago pm2 statusveo que mi proceso está en línea. No hay errores en pm2 logs. De alguna manera Apache y pm2 no se hablan.

netstat -tulpnconfirma que no hay nada escuchando en el puerto 4000.

No sé que más hacer. ¿Algunas ideas?

Respuesta1

No puede definir el puerto -pen PM2, no existe tal opción. Probablemente la variable pueda hacer el trabajo (como mencionas en tu comentario):

port=4000 pm2 start index.js

información relacionada