系统装的是Gentoo
实际上在gentoo上面如果用apache的话那装nagios是相当方便的,但我就是想把nagios装在nginx上面没办法^_^
wget http://www.nginx.eu/nginx-fcgi/nginx-fcgi.txt mv nginx-fcgi.txt nginx-fcgi.pl mv nginx-fcgi.pl /usr/bin/ chmod 777 /usr/bin/nginx-fcgi.pl perl -MCPAN -e shell cpan> install FCGI cpan> install IO::All cpan> install Socket nginx-fcgi.pl -l /tmp/nginx-fcgi.log -pid /tmp/nginx-fcgi.pid -S /tmp/nginx-fcgi.sock chmod 777 /tmp/nginx-fcgi.* vi /etc/nginx/vhosts/nagios.conf server { listen 80; server_name nagios.yemaosheng.com; index index.php index.html index.htm; root /usr/local/nagios/share; location ~ .*\.php?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/local/nagios/share$fastcgi_script_name; } location /nagios/ { gzip off; alias /usr/local/nagios/share/; index index.html index.htm index.php; } location ~ \.cgi$ { rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break; fastcgi_pass unix:/tmp/nginx-fcgi.sock; fastcgi_index index.cgi; fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name; fastcgi_param HTTP_ACCEPT_LANGUAGE en_US; include fastcgi_params; } location ~ \.pl$ { fastcgi_pass unix:/tmp/nginx-fcgi.sock; fastcgi_index index.pl; fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin$fastcgi_script_name; include /etc/nginx/fastcgi_params; } } |
转载请注明出处: http://yemaosheng.com
请教下为什么我按照楼主的配置只能看见第一个页面
在点其他的选项都是502 Bad Gateway
502 Bad Gateway 一般是fastcgi的问题
增加了fastcgi的timeout时间试试
也可能是cgi进程数不够用,执行时间长,或者是进程死掉
google上此类问题很多
进程数开了20几个都是好好的!timeout这个应该不是!应为我跑别的php网页一点问题都没!我感激问题就出在跑cgi 上面那个nginx-fcgi.pl 好像开不开都没影响不起作用!
还有奇怪的就是http://192.168.1.103/ 直接IP能看到第一个一面 http://192.168.1.103/nagios 这样访问直接404
搞了半天还是/tmp没权限无语!呵呵
呵呵,上面有写chmod 777 /tmp/nginx-fcgi.*
我一开始装也忘了这个
问下你如何加入密码验证
用apache的htpasswd命令生成htpasswd文件,然后nginx配置如下例:
location /nginx {
stub_status on;
access_log on;
auth_basic “NginxStatus”;
auth_basic_user_file /usr/local/etc/nginx/htpasswd;
}
谢谢!请问下有没相关监控的配置
“监控”一栏中有安装步骤
http://www.nginx.eu/nginx-fcgi/nginx-fcgi.txt下载不了,博主可否贴出这个txt文件的内容?
抱歉才看到,你可以看下这个http://nginx.localdomain.pl/wiki/FcgiWrap
gentoo下直接emerge它.