Install Monit to serve Nginx
Aug 9, 2017 · 1 min read
Monit is open source. It automatically monitors and manages server process, files, directories, checksums, permissions, filesystems and services like Apache, Nginx, MySQL, FTP, SSH so on in a UNIX/Linux based systems.
It has a friendly web interface and very useful tool for system administrators.
Steps to install Monit
$ sudo apt-get install monitConfigure Monit by
$ sudo vi /etc/monit/monitrcPolling frequency (This is the interval (in seconds) at which Monit runs its tests.)
set daemon 120Edit (Uncomment following)
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server
allow admin:monit # require user 'admin' with password 'monit'
allow @monit # allow users group 'monit' to connect (rw)
allow @users readonly # allow users group 'users' to connect (r)Add monitoring service for Nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"Check for syntax errors
$ sudo monit -tWhen there are no errors and shows message like “Control file syntax OK“ then
Restart Monit
$ sudo /etc/init.d/monit restartVerify Monit running by checking the logs
$ sudo tail -f /var/log/monit.log