ProxyNagios

= Nginx as a Proxy to Nagios =

In this example it is assumed that a Nagios 2 installation runs on another (maybe virtual) box and that nginx shall sit as a reverse proxy and SSH-Endpoint between the Nagios-instance and the world. Access-Control is managed by Nagios itself and is out of scope here.

Plain Vanilla Nagios Setup
Nagios sits in its own (virtual box) integrated with apache2. The relevant parts of the apache-configuration are these :

ScriptAlias /cgi-bin/nagios2 /usr/lib/cgi-bin/nagios2 Alias /nagios2 /usr/share/nagios2/htdocs

 Options FollowSymLinks AllowOverride AuthConfig Order Allow,Deny Allow From All AuthName "Nagios Access" AuthType Basic AuthUserFile /etc/nagios2/htpasswd.users require valid-user 

Nginx Rwrite Rules
server {
 * 1)  ... a lot omitted ...

location /cgi-bin/nagios2/ { proxy_pass http://inagios:80/cgi-bin/nagios2/; proxy_redirect default; }

location /nagios2/ { proxy_pass http://inagios:80/nagios2/; proxy_redirect default ; }

location /nagios/ { proxy_pass http://inagios:80/nagios2/; proxy_redirect default ; } }

Discussion
I am not too content with this solution. It works but I don't like the repetition. This bothers me because I want to provide other services too and then the ngingx.conf will become unwieldy.

So feel free to amend this example.