简体   繁体   中英

Run production server Java and node application in the background?

I have this complex web application where Nginx is running in the front to forward requests to a Node server and the Node server is using a Java .jar application. I want to run all these in a production environment. Nginx is no problem as it's running as a usual process. How do I run the Node application in the background so that it survives restarts and also the Java application (includes extra parameters to be set in both the application start command).

It's an Ubuntu Digitalocean machine. Here is the sample start commands-

sudo java -jar -Dapplication.secret=secret -Dapplication.publicurl= https://104.329.374.846:8888/ application.jar

sudo node server.js localhost:8888 secret

What will be the way to run both the applications in a way that when application will error out and stop (this is not a must) or Ubuntu will reboot, both these applications will auto restart on reboot, with the parameters in the commands auto set.

  • List item

对于NodeJS应用程序,您还有pm2选项,易于使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM