Nagios 3 with Nginx on Ubuntu Server

1. Install Nagios 3

aptitude install nagios3

2. Test Nagios Installation

Open „http://SERVER/nagios3/“ in your browser. Login with user „nagiosadmin“ and the passwort you have entered during the installation.

3. Switch from Apache to Nginx

Nagios has dependencies to the Apache webserver. So Apache was installed with Nagios. Now we replace it with Nginx.

3.1 Install Nginx and libfcgi (Perl)
aptitude install nginx libfcgi-perl
3.2 Configrate Fastcgi

Download fastcgi-wrapper and init scripts: perl-fastcgi (841 Downloads )

wget http://www.mogilowski.net/wp-content/uploads/perl-fastcgi.tar.gz
tar vfx perl-fastcgi.tar.gz
mv fcgi/fastcgi-wrapper /usr/bin/fastcgi-wrapper.pl
mv fcgi/perl-fastcgi /etc/init.d/perl-fastcgi
rmdir fcgi 
chmod +x /usr/bin/fastcgi-wrapper.pl
chmod +x /etc/init.d/perl-fastcgi
update-rc.d perl-fastcgi defaults
/etc/init.d/perl-fastcgi start
3.3. Configurate Nginx
vim /etc/nginx/sites-available/nagios
server {
	listen   80;
	server_name  servername.com;
 
	access_log  /var/log/nginx/access.log;

	auth_basic            "Restricted Nagios Area!";
  	auth_basic_user_file  /etc/nagios3/htpasswd.users;	

	location / {
		root /usr/share/nagios3/htdocs;
		index index.html;

		rewrite ^/nagios3/(.*)$ /$1 break;
	}

	location /nagios3/stylesheets {
                alias /etc/nagios3/stylesheets;
        }

	location ~ \.cgi$ {
		root /usr/lib/cgi-bin/nagios3;
		include /etc/nginx/fastcgi_params;

		rewrite ^/cgi-bin/nagios3/(.*)$ /$1;

		fastcgi_pass 127.0.0.1:8999;
		fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/nagios3$fastcgi_script_name;
		fastcgi_param AUTH_USER       $remote_user;
		fastcgi_param REMOTE_USER     $remote_user;
	}

}
ln -s /etc/nginx/sites-available/nagios /etc/nginx/sites-enabled/nagios
/etc/init.d/nginx restart
3.4 Remove Apache

Now you can remove all apache pakets. Exept „apache2-utils“ this paket is required by nagios3.

4. Test with Nginx

Open „http://SERVER/nagios3/“ in your browser. Login with user „nagiosadmin“ and the passwort you have entered during the installation.

5. Links

* http://inode.co.nz/running-nagios3-under-nginx-fastcgi

* http://library.linode.com/web-servers/nginx/perl-fastcgi/ubuntu-10.04-lucid

* http://wiki.linuxwall.info/doku.php/fr:ressources:dossiers:supervision:nagios3

* http://wiki.nginx.org/Main

* http://www.nagios.org

This Post Has One Comment

Schreibe einen Kommentar

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.