0

I'm trying to set up nagios3 with nginx on Ubuntu 14.04, and I'm having some trouble that I hope someone can shed some light on. I just get a blank page, instead of the expected Nagios page. It seems to be serving the index.php file, but empty of any tags, text, or data of any type.

I have it set up in pretty standard fashion, using basic auth, and I've basically been cut and pasting the configs.

nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    upstream php {
            server unix:/var/run/php5-fpm.sock;
    }

    upstream fcgiwrap {
        server unix:/var/run/fcgiwrap.socket;
    }
}

vhost file:

server {
  listen   80;
  server_name  nagios.domain.com;

  access_log  /var/log/nginx/nagios.access.log;
  error_log   /var/log/nginx/nagios.error.log info;

  expires 31d;

  root /usr/share/nagios3/htdocs;
  index index.php index.html;

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

  rewrite ^/nagios3/images/(.*)$ /images/$1;
  rewrite ^/nagios3/js/(.*)$ /js/$1;

  location ~ \.css/?$ {
    root /etc/nagios3/stylesheets/;
    rewrite [/nagios3]?/stylesheets/(.*\.css)/?$ /$1;
  }

  location ~ \.cgi$ {
    root /usr/lib/cgi-bin/nagios3;

    rewrite ^/cgi-bin/nagios3/(.*)$ /$1;
    include /etc/nginx/fastcgi_params;
    fastcgi_param AUTH_USER $remote_user;
    fastcgi_param REMOTE_USER $remote_user;
    fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/nagios3$fastcgi_script_name;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
  }

  location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
  }
}

I get the following error in /var/log/nginx/nagios.error.log:

2016/07/06 17:23:02 [info] 10022#10022: *5 client closed connection while waiting for request, client: 10.20.0.1, server: 0.0.0.0:80

The index.php is where it's expected to be, with the following permissions:

-rw-r--r-- 1 root root 1642 Jan  9  2014 index.php

It's the stock, out of the box nagios index.php, no modifications.

sudo service fcgiwrap status gives me the following:

* Checking status of FastCGI wrapper fcgiwrap   [ OK ]

If anyone could offer any guidance, I would greatly appreciate it.

Keith
  • 4,637
  • 15
  • 25
Phyl
  • 1
  • 2

1 Answers1

0

it looks like you may have copied your code from [http://unix.rocks/2014/nginx-and-nagios-a-howto/], but missed this line in the php config:

 include /etc/nginx/fastcgi.conf;
adam
  • 101