2014-03-18 15:44:01
来 源
kejihao
Nginx安装配置
本文介绍Nginx服务器perl运行环境的配置方法,希望对于初学Nginx服务器相关的朋友有帮助,更多Nginx安装、配置、报错处理等资源请本站内搜索。。
实际上在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  www.server110.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;

  }

}

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。