nagios + nginx + fcgi
Dima Nelen
dnelen at gmail.com
Mon Oct 15 18:24:52 MSD 2007
добрый день,
вот решил отказаться от апача и поставить nagios под nginx. для cgi,
где-то на китайском сайте, нашел модуль для прикручивания cgi файлов,
как fastcgi. вроди всё хорошо работало, пока не дошло до post
запросов. подскажите куда копать, ну уж очень не хочется вешать апач (
* perl-cgi.pl - скрипт, который вешается в виде fcgi сервера
* Firefox, LiveHTTPHeaders
http://nagios.worldapp/nagios/cgi-bin/cmd.cgi
POST /nagios/cgi-bin/cmd.cgi HTTP/1.1
Host: nagios.worldapp
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.8.1.7)
Gecko/20071003 Firefox/2.0.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://nagios.worldapp/nagios/cgi-bin/cmd.cgi?cmd_typ=6&host=localhost&service=Total+Processes
Authorization: Basic ZGV4eDpkZWx0YQ==
Content-Type: application/x-www-form-urlencoded
Content-Length: 75
cmd_typ=6&cmd_mod=2&host=localhost&service=Total+Processes&btnSubmit=Commit
HTTP/1.x 502 Bad Gateway
Server: nginx/0.5.26
Date: Mon, 15 Oct 2007 14:20:01 GMT
Content-Type: text/html
Content-Length: 383
Connection: keep-alive
* nagios config - почти дефолтный
* конфиг nginx host:
server {
listen 80;
server_name nagios.worldapp;
#charset koi8-r;
access_log /var/log/nginx/nagios.access.log main;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location / {
root /usr/local/nagios/share;
auth_basic "Restricted";
auth_basic_user_file /usr/local/nagios/etc/htpasswd.user;
}
location ~ \.cgi$ {
root /usr/local/nagios/sbin;
rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
fastcgi_index index.cgi;
auth_basic "Restricted";
auth_basic_user_file /usr/local/nagios/etc/htpasswd.user;
fastcgi_pass unix:/usr/local/nagios/var/run/fcgi/nagios.sock;
fastcgi_param SCRIPT_FILENAME
/usr/local/nagios/sbin$fastcgi_script_name;
fastcgi_param QUERY_STRING
$query_string;
fastcgi_param REMOTE_ADDR
$remote_addr;
fastcgi_param REMOTE_PORT
$remote_port;
fastcgi_param REQUEST_METHOD
$request_method;
fastcgi_param REQUEST_URI
$request_uri;
fastcgi_param SCRIPT_NAME
$fastcgi_script_name;
fastcgi_param SERVER_ADDR
$server_addr;
fastcgi_param SERVER_NAME
$server_name;
fastcgi_param SERVER_PORT
$server_port;
fastcgi_param SERVER_PROTOCOL
$server_protocol;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param CONTENT_LENGTH
$content_length;
fastcgi_param CONTENT_TYPE
$content_type;
fastcgi_param GATEWAY_INTERFACE CGI/1.0;
fastcgi_param HTTP_ACCEPT_ENCODING gzip,deflate;
fastcgi_param HTTP_ACCEPT_LANGUAGE en;
#include conf/fastcgi_params;
}
}
--
*#)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: perl-cgi.pl
Type: text/x-perl
Size: 1996 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20071015/977006ce/attachment.pl>
More information about the nginx-ru
mailing list