I have a micro instance on EC2, and I deployed a wordpress website on it. But the site will be down about every two days because mysql is killed, so visitors get “500 Internal Server Error”.
And I need log in AWS, and reboot the instance. I know I should optimize the apache configuration, but rebooting the instance will be a simple solution.
I’m using a service which can monitor my website, and when site is down, they will send me a email, but they can’t reboot the EC2 instance.
I configure the apache like below, it works now:
StartServers 1
MinSpareServers 1
MaxSpareServers 5
MaxClients 10
MaxRequestsPerChild 4000
Maybe you can create a bash, and put it in /etc/cron.hourly to run it every hour.
Here is the content of bash.
Don’t forget to make it executable just like the below.
Moreover you can make it check more frequently by create a file in /etc/cron.d/ like the below to check every 5 minutes.