Monitor Apache using monit

Monit is a small Open Source utility for managing and monitoring Unix systems. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

Installing monit on CentOS 7


yum install epel-release -y
yum install monit -y

Once installed, save the following in /etc/monit.d/apache


check process httpd with pidfile /var/run/httpd/httpd.pid
group apache
start program = "systemctl start apache"
stop program = "systemctl stop apache"
if failed host 127.0.0.1 port 80 protocol http
with timeout 15 seconds
then restart
if 5 restarts within 5 cycles then timeout

Notes:

  1. Adjust httpd.pid if your apache’s pid is in a different location. On a default installation it might be at /var/run/httpd.pid

Start monit


# Checks for syntax errors
monit -t  
monit 

There are advanced settings which can be adjusted by modifying the file /etc/monitrc such as email notification etc.

Just Moved My Blog To A Separate VPS Powered By Nginx Web Server

My Blog has received around 900 page views for the last 7 days! Today I noticed that my blog is loading slow when I tried to post an article and upload some images. The blog was on a cPanel VPS. As you may already know, cPanel is a resource hog and hosting WordPress on a cPanel box with unoptimized mysql is really a bad idea when the blog gets some hits. So finally I’ve decided to move to a new VPS.

Thus, I’ve created a new VPS with CentOS 5 32bit Operating System installed. My first plan was to install Apache on it, but later I’ve decided to give Nginx a try after reading this article on WordPress.org

Installing Nginx with PHP-FPM on a server and configuring it with WordPress is really a time consuming task. And I have done it today.

Continue reading “Just Moved My Blog To A Separate VPS Powered By Nginx Web Server”