Apache가 PM2 노드 프로세스를 볼 수 없음

Apache가 PM2 노드 프로세스를 볼 수 없음

Ubuntu 20에서 Apache를 실행 중인데 다음 오류가 계속 발생합니다 /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

내 가상 호스트는 다음과 같이 설정됩니다.

<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>

내 웹 디렉터리( /var/www/example.com)에서 다음과 같이 pm2로 앱을 시작했습니다.

pm2 start index.js -p 4000

그렇게 하면 pm2 status내 프로세스가 온라인 상태임을 알 수 있습니다. 에는 오류가 없습니다 pm2 logs. 어떻게 든 Apache와 pm2는 서로 통신하지 않습니다.

netstat -tulpn포트 4000에서 수신 대기 중인 항목이 없음을 확인합니다.

나는 무엇을 해야할지 모르겠습니다. 어떤 아이디어가 있나요?

답변1

PM2에서는 포트를 정의할 수 없으며 -p그러한 옵션이 없습니다. 아마도 변수가 작업을 수행할 수 있습니다(댓글에서 언급했듯이).

port=4000 pm2 start index.js

관련 정보