问题原文
原帖链接 · Newbee Coding · CC BY-SA 4.0
I have deployed my application onto AWS EC2 and I want to implement automation where if I restart my instance or when the Nginx web server is down, it will restart by itself. I do not really know where to start with this.
I heard I can use crontab to schedule automatic monitoring and if it is down, it can send email alerts and restart the webserver.
社区高分解答
原帖链接 · Simon Richter · CC BY-SA 4.0
You already have lots of answers how to do it, but I'd investigate what is happening to make it shut down in the first place, and fix that.
When nginx crashes, all currently running requests will be terminated in an unknown state -- files half-transferred, API calls unreplied. In principle the application on top should deal with this, in practice they seldom do, but at that layer it will manifest as weird and unreproducible behaviour, giving the people using the service an feeling of instability (and rightfully so).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
