快速业务通道

Nginx nagios perl fcgi 取缔apache

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-27
Nginx nagios perl fcgi 通常使用:nginx 代理 apache CGI部分交给apache来处理本文取消apache

Nginx nagios 安装略 安装perl cgi模块wget http://www.cpan.org/modules/by-module/FCGI/FCGI-0.67.tar.gz
tar -zxvf FCGI-0.67.tar.gz
cd FCGI-0.67
perl Makefile.PL
make && make install

安装FCGI-ProcManager:
wget http://search.cpan.org/CPAN/authors/id/G/GB/GBJK/FCGI-ProcManager-0.18.tar.gz
tar -xzxf FCGI-ProcManager-0.18.tar.gz
cd FCGI-ProcManager-0.18
perl Makefile.PL
make make install 下载nginx-fcgi脚本Wget http://www.nginx.eu/nginx-fcgi/nginx-fcgi.txt 放置在:/etc/nginx-fcgi
注释掉nginx-fcgi.txt 中的
if ( contentgt; == “0″ ) {
print “ntERRORtRunning as a root!n”;
print “tSuggested not to do so !!!nn”;
exit 1;
}
否则会提示:ERROR Running as a root! Suggested not to do so !!!

启动方法:/etc/nginx-fcgi -l /var/log/nginx/nginx-fcgi.log -pid /var/run/nginx-fcgi.pid -S /var/run/nginx-fcgi.sock注意给 nginx-fcgi.sock 777的权限
运行前使用cpan 安装 FCGI;  Getopt::Long; IO::All;  Socket;
配置文件参考:/usr/local/nginx/conf/vhosts/nagios.confserver { listen 80; server_name IP;root /usr/local/nagios/share;index index.php;location ~ .*\.(php|php5)?${fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include enable_php5.conf;auth_basic "Nagios Login pain";auth_basic_user_file /usr/local/nagios/etc/htpasswd;}
Empire CMS,phome.net
location ~ .*\.cgi$ {root /usr/local/nagios/sbin;rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;fastcgi_pass unix:/var/run/ng-fcgi.sock;fastcgi_index index.cgi;fastcgi_param SCRIPT_FILENAME /usr/local/nagios/sbin/$fastcgi_script_name;fastcgi_param HTTP_ACCEPT_LANGUAGE zh-cn;include enable_php5.conf;auth_basic "Nagios Login pain";auth_basic_user_file /usr/local/nagios/etc/htpasswd; }location /nagios/ {alias /usr/local/nagios/share/; } enable_php5.conf 参考:fastcgi_param GATEWAY_INTERFACE CGI/1.1;fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string;fastcgi_param REQUEST_METHOD $request_method;fastcgi_param CONTENT_TYPE $content_type;fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param SCRIPT_NAME $fastcgi_script_name;fastcgi_param REQUEST_URI $request_uri;fastcgi_param DOCUMENT_URI $document_uri;fastcgi_param DOCUMENT_ROOT $document_root;fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr;fastcgi_param REMOTE_PORT $remote_port;fastcgi_param SERVER_ADDR $server_addr;fastcgi_param SERVER_PORT $server_port;fastcgi_param SERVER_NAME $server_name;fastcgi_param HTTP_ACCEPT_ENCODING gzip,deflate; 如果报CGI 无法访问的错.请修改nagios里cgi.cfg
Empire CMS,phome.net
use_authentication=1 给予执行权限



参考:http://bbs.linuxtone.org/thread-4441-1-1.html http://www.nginx.eu/nginx-fcgi.htmlhttp://wi

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号