Nginx settings

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
matisse
Posts: 30
Joined: Wed Aug 31, 2016 4:33 pm

Nginx settings

Post by matisse »

Hi, i need your help.
I am trying to settings Nginx. But web-interface is no available via URL i need. I have domain, for example nagios.mydomain.ru.
Got error:

Code: Select all

[error] 6783#0: *51946 directory index of "/usr/local/nagios/share/nagios/" is forbidden
But i can get nagios via only servername.mydomain.ru.
It is my Nginx config:

Code: Select all

server {
        listen   80;
        server_name   nagios.mydomain.ru;
        access_log  /var/log/nginx/nagios-access.log;
        error_log   /var/log/nginx/nagios-error.log info;

        root /usr/local/nagios/share;
        index index.php;

        auth_basic "Nagios Restricted Access";
        auth_basic_user_file /usr/local/nagios/etc/htpasswd.users;

        location /stylesheets {
                alias /usr/local/nagios/share/stylesheets;
        }

        location ~ .cgi$ {
                root /usr/local/nagios/sbin/;
                include fastcgi_params;
                rewrite ^/nagios/cgi-bin/(.*).cgi /$1.cgi break;
                fastcgi_param AUTH_USER $remote_user;
                fastcgi_param REMOTE_USER $remote_user;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
                fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin/$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                }

        location ~ .php$ {
                include fastcgi_params;
                fastcgi_pass unix:/var/run/php-fpm/nagios.socket;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /usr/local/nagios/share$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                }

         location ~ (.*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf))$ {
                root /usr/local/nagios/share/;
                rewrite ^/nagios/(.*) /$1 break;
                access_log off;  expires max;
        }

}
What the problem?
Thanks!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nginx settings

Post by mcapra »

Did you use any sort of tutorial/documentation to set this up?

What operating system is Nagios Core installed on?

Can you share the contents of the error log? (/var/log/nginx/nagios-error.log)



This implies the nginx user doesn't have proper permissions over the /usr/local/nagios/share/nagios/ path:

Code: Select all

[error] 6783#0: *51946 directory index of "/usr/local/nagios/share/nagios/" is forbidden
Can we also see an output of the following command executed from the CLI of your Nagios Core machine:

Code: Select all

ls -al /usr/local/nagios/share
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nginx settings

Post by dwhitfield »

mcapra wrote:Did you use any sort of tutorial/documentation to set this up?
This would be really useful since we usually use apache. We can certainly lab something up, but setting it up like you did would be best.
Locked