Nagios served by NginX

Ilan Berkner iberkner at gmail.com
Thu Dec 30 19:32:17 MSK 2010


This works for me:

http
{
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    sendfile on;
    tcp_nopush on;
    client_max_body_size 6m;
    gzip on;
    gzip_min_length 0;
    gzip_comp_level 6;
    gzip_types text/css application/json application/x-javascript text/xml
application/xml application/xml+rss text/javascript;
    log_format   main '$remote_addr - $remote_user [$time_local] $status '
                      '"$request" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log   /var/log/nginx/access.log  main;
    access_log off;
    root /var/www/html;
    server
    {
        listen  10.0.1.163;
        server_name  dev.local.com;
        location = /nagios
        {
                rewrite ^/nagios/ permanent;
        }
        location /nagios/
        {
                index index.php index.html;
                alias /usr/local/nagios/share/;
        }
        location /
        {
                index  index.php index.html;
                error_page 404 = @joomla;
                log_not_found off;
        }
        location @joomla
        {
                rewrite ^(.*)$ /index.php?q=$1 last;
        }
        location ~ ^/nagios/(.*\.php)$
        {
                alias /usr/local/nagios/share/$1;
                fastcgi_pass 127.0.0.1:9000;
                include fcgi;
                auth_basic "Restricted";
                auth_basic_user_file htpasswd;
        }
        location ~ \.cgi$
        {
                root    /usr/local/nagios/sbin/;
                rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
                fastcgi_pass   127.0.0.1:49233;
                include fcgi;

                auth_basic              "Restricted";
                auth_basic_user_file    htpasswd;

                fastcgi_param  AUTH_USER          $remote_user;
                fastcgi_param  REMOTE_USER        $remote_user;
        }
        location ~ \.php$
        {
                include fcgi;
                fastcgi_pass 127.0.0.1:9000;
        }

    }



On Thu, Dec 30, 2010 at 11:23 AM, nofun <nginx-forum at nginx.us> wrote:

> Can some one please help me setting up Nagios on NginX. I installed
> spawn-fcgi and fcgiwrap in Ubuntu, and I have Nagios 3.2.3 installed in
> /opt/nagios. So I have the two folders: /opt/nagios/share for web files,
> and /opt/nagios/sbin for cgi scripts.
>
> I tried with this config (with no success though):
> [code]
> location / {
>                root   /opt/nagios/share;
>                index  index.html;
>
>                rewrite ^/nagios/images/(.*)\.png /images/$1.png break;
>
>                auth_basic              "Restricted";
>                auth_basic_user_file    conf/htpasswd;
>        }
>
>        location ~ \.cgi$ {
>                root    /opt/nagios/sbin;
>                rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
>
>                include /etc/nginx/fastcgi_params;
>
>                fastcgi_pass   unix:/var/run/fcgiwrap.socket;
>                fastcgi_param  SCRIPT_FILENAME
> /opt/nagios$fastcgi_script_name;  # same path as above
>
>                auth_basic              "Restricted";
>                auth_basic_user_file    conf/htpasswd;
>
>                fastcgi_param  AUTH_USER          $remote_user;
>                fastcgi_param  REMOTE_USER        $remote_user;
>        }
> [/code]
>
> This config is adaped from
> http://www.matejunkie.com/howto-let-nginx-serve-the-nagios-web-interface/
>
> Does anyone use Nagios with NginX and can send me a working
> configuration?
>
> Thank you in advance,
> Vlad.
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,162278,162278#msg-162278
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101230/beea611f/attachment.html>


More information about the nginx mailing list