I am having trouble configuring Nagios on Arch Linux served by Nginx. The Nagios services run without hitches, but the serving via Nginx is broken. As you can see from the screenshot, the fonts are all messed up and the icons do not appear in the browser. I suspect that the paths to the CSS and image files are somehow broken and therefore not seved by Nginx.
Here is my Nginx virtual server conf. I assume that I have made some stupid error, but I cannot spot the problem.
The error log shows the following:
*334 open() "/usr/share/nagios/share/nagios/images/ndisabled.gif" failed (2: No such file or directory)
However, the GIF is located at /usr/share/nagios/share/images/ndisabled.gif
indicating that there is some confusion with the paths, which however I do not know how to best fix.
Probably one or the other Nginx/Nagios expert roaming this forum will find the issue in a microsecond!
server {
server_name nagios.bellaria www.nagios.bellaria;
root /usr/share/nagios/share;
listen 80;
index index.php index.html index.htm;
access_log nagios.access.log;
error_log nagios.error.log;
auth_basic "Nagios Access";
auth_basic_user_file /etc/nagios/htpasswd.users;
location ~ \.php$ {
try_files $uri = 404;
fastcgi_index index.php;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
include fastcgi.conf;
}
location ~ \.cgi$ {
root /usr/share/nagios/sbin;
rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
fastcgi_pass unix:/run/fcgiwrap.sock;
}
location /stylesheets {
alias /usr/share/nagios/share/stylesheets;
}
}
Maybe nagios look for images on /nagios/images because of some configuration. Check the source code of page (Ctrl+ u ) to confirm.
You can do an alias for nagios:
Also check the config file
cgi.cfg
.(Sorry for my english)
In freebsd on my nagios with nginx I use this config for php/CGI, maybe this help you with your cgi problem: