I have ssh into my VPS and created the initial react app on the server with npx create-react-app test
. I then run command npm start
I then with another terminal that is also ssh, curl to curl http://localhost:3000
and receive the correct response.
I then close the initial sever that had npm start
. I then redo the curl http://localhost:3000
and fail to connect. Shouldn't the curl have been successful, I thought the VPS would run indefinitely as it is a sever? How do I get this sever to continuously run after I close the ssh connection?
When you run npm start
, it starts a development server process that serves your React application.
To keep the server running even after you disconnect from the SSH session, you can use some process manager like pm2
, forever
, or screen
.
But it's good idea to use nginx
to run your project on the VPS server.
See this link.
[https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-22-04][1]