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/
group apache
start program = "systemctl start apache"
stop program = "systemctl stop apache"
if failed host port 80 protocol http
with timeout 15 seconds
then restart
if 5 restarts within 5 cycles then timeout


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

Start monit

# Checks for syntax errors
monit -t  

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

How To Add SPF And DomainKeys on cPanel Servers

This code snippet is the simplest way to add SPF and DomainKeys on a cPanel server for all the accounts

for i in $(ls /var/cpanel/users)
echo Installing Domain Keys on $i
/usr/local/cpanel/bin/domain_keys_installer $i;
echo Installing SPF Records on $i
/usr/local/cpanel/bin/spf_installer $i;