Search code examples
sslcreate-react-apppm2

How to serve react app with pm2 server in https with a valid SSL certificate that I have?


I am trying deploy a React-App(backend = python) chatbot with pm2 serve. I have valid SSL certificate files from digitalocean. I use the following commands to serve.

npm run build
pm2 serve build 3000 --spa

But this opens in http url only. How to serve with pm2 in https using certificates. is there any command to do it? Thanks in advance.


Solution

  • Try this one. This worked for me.

    pm2 start --name front "HTTPS=true SSL_CRT_FILE=../certs/certificate.crt SSL_KEY_FILE=../certs/private.key npm" --start