简体   繁体   English

如果服务器重新启动,是否需要在EC2上手动重新启动我的应用程序?

[英]Do I need to manually restart my app on EC2 if the server restarts?

This is my first time with EC2 so keep that in mind. 这是我第一次使用EC2,因此请记住这一点。 I spun an EC2 instance and put a really basic nodejs/express app up on it. 我旋转了一个EC2实例,并在其上放置了一个非常基本的nodejs / express应用程序。 I connected to the ec2 server via the terminal on my personal computer and ran node app.js to start the app and everything is running fine. 我通过个人计算机上的终端连接到ec2服务器,并运行节点app.js来启动应用程序,并且一切运行正常。 The part I am confused about is how long this will run for. 我感到困惑的部分是它将持续多长时间。 Ideally, I just want it to sit there and not touch it and have it run for hopefully years. 理想情况下,我只希望它坐在那里而不碰它,并让它运行多年。 Will it do this? 会这样做吗? If not what do I need to do? 如果没有,我该怎么办? What if the server restarts for some reason? 如果服务器由于某种原因重新启动怎么办? What is the common practice here? 这里的惯例是什么?

Go to root directory of your project and type this command to run the server permanently. 转到项目的根目录,然后键入此命令以永久运行服务器。

sudo npm install forever -g
forever start -c "node app.js" ./

博客对于为生产环境设置节点可能会有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果在Amazon EC2上CPU使用率达到100%并且服务器停止时,如何重新启动我的节点js应用程序 - How to restart my node js app when the CPU usage reach 100% on Amazon EC2 and the server stops 我是否只需要一个具有更多内存的EC2实例,还是此错误表明我的代码中存在问题? - Do I just need an EC2 instance with more memory or does this error suggest issues in my code? 当我将 SSH 插入我的 EC2 实例时,我如何确定它当前正在运行什么服务器? - When I SSH into my EC2 instance, how do I figure out what server it is currently running? 我怎样才能在亚马逊ec2服务器上找到我的名字服务器? - how can i find my Nameservers on amazon ec2 server? 我是否需要在节点服务器上托管我的角度应用程序 - Do i need to host my angular app with a node server 为什么我每次都需要重启 npm 服务器? - Why do i need to restart npm server everytime? unhandledRejection 后是否需要重新启动我的应用程序 - Do I need to restart my application after unhandledRejection 是否可以将Web服务器和App服务器部署到同一AWS EC2实例? - Can I deploy a Web server and an App server to the same AWS EC2 instance? 我无法从外部访问我的AWS EC2上的node.js服务器 - I can't access my node.js server on my AWS EC2 isntance from the outside 我是否总是需要在服务器上运行我的Parse Server应用程序? - Do I always need to be running my Parse Server app on my server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM