這一陣子 stickeraction 的 lighttpd 都會因為 php fcgi 死掉然後吐 500, 但是參數怎麼調都沒用. 後來看到 monit 這個東西, 真是個好物, 我就用 monit 來監測 lighttpd 有沒有死掉, 如果有死掉的話就自動把 lighttpd 重開。
用了 monit 之後, stickeraction 再也沒 down time 了 LOL ( 好啦~ 最多會有兩分鐘 XD )
我還滿喜歡 monit 的設定的, 簡單又清楚, 範例如下:
check process lighttpd with pidfile /var/run/lighttpd.pid
start program = "/etc/init.d/lighttpd start"
stop program = "/etc/init.d/lighttpd stop"
if failed host stickeraction.com port 80 protocol http
with timeout 15 seconds
then restart
會監看 lighttpd, timeout 15 秒就會把 lighttpd resart。
另外 monit 也提供了一個 web 界面, 設定也很簡單如下, 而在 web 界面上就可以直接 start, stop 或重開 service, 滿方便的
set httpd port 8080 and
allow 0.0.0.0
allow your_username:your_password



