Hi guys,
While playing around with Nagios under nginx, I noticed that I cannot get the cgi part of Nagios to work properly and I need a hand or a suggestion here:
nginx.conf:
user www;
worker_processes 1;
error_log /var/log/nginx-error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http{
index index.php index.hmtl index.htm;
# Nagios
server {
listen 80;
server_name nagios.nginx.local;
include /usr/local/etc/nginx/fastcgi_params;
root /usr/local/www/nagios;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
auth_basic "Restricted";
auth_basic_user_file /usr/local/www/nagios/.htpasswd;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 192.168.69.148:9000;
}
location ~ \.cgi$ {
rewrite ^/cgi-bin/(.*)\.cgi /$1.cgi break;
fastcgi_pass 192.168.69.148:9000;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}
# Suppress the noisy "favicon.ico not found" err msg
location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
}
# End nagios
###############
# END SERVERS #
###############
I have the following packages installed:
fcgi-devkit-2.4.0
fcgiwrap-1.0.3_3
spawn-fcgi-1.6.3
And the following listening:
www php-cgi 25696 0 tcp4 192.168.69.148:9000 *:*
www php-cgi 25383 0 tcp4 192.168.69.148:9000 *:*
www php-cgi 21656 0 tcp4 192.168.69.148:9000 *:*
www php-cgi 21655 0 tcp4 192.168.69.148:9000 *:*
www php-cgi 21654 0 tcp4 192.168.69.148:9000 *:*
www php-cgi 21651 0 tcp4 192.168.69.148:9000 *:*
root fcgiwrap 21630 0 stream /var/run/fcgiwrap/fcgiwrap.sock
I get a "502 Bad Gateway" when I want to access anything cgi-wise in Nagios and the following in the nginx.log file:
2011/10/11 14:34:40 [error] 25695#0: *13 upstream prematurely closed connection while reading response header from upstream, client: 192.168.69.248, server: nagios.nginx.local, request: "GET /nagios/cgi-bin/status.cgi?host=all HTTP/1.1", upstream: "fastcgi://192.168.69.148:9000", host: "nagios.nginx.local", referrer: "http://nagios.nginx.local/side.php"
Any ideas are welcomed.