nginx下的nagios pnp4nagios
#Spawn-FCGI
一个通用的FastCGI管理服务器,它是lighttpd中的一部份,很多人都用Lighttpd的Spawn-FCGI进行FastCGI模式下的管理工作
#fcgiwrap(Simple FastCGI wrapper for CGI scripts)
为那些不支持直接运行CGI脚本的Web服务器提供一种运行CGI脚本的方式。
nagios运行cgi,所以需要fcgiwrap为nginx解析cgi。
yum -y install fcgiwrap-1.1.0-1.gf.el7.x86_64.rpm
yum -y install php-fpm spawn-fcgi
# php-fpm
/etc/php-fpm.d/www.conf
listen = /var/run/php-fpm.sock
systemctl restart php-fpm
#spawn-fcgi & fcgiwrap
cat > /etc/sysconfig/spawn-fcgi << EOF
FCGI_SOCKET=/var/run/fcgiwrap.sock
FCGI_PROGRAM=/usr/sbin/fcgiwrap
FCGI_USER=nginx
FCGI_GROUP=nginx
FCGI_EXTRA_OPTIONS="-M 0700"
OPTIONS="-u \$FCGI_USER -g \$FCGI_GROUP -s \$FCGI_SOCKET -S \$FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- \$FCGI_PROGRAM"
EOF
systemctl restart spawn-fcgi
/etc/nginx/conf.d/nagios.conf 没用alias,直接用虚拟主机方式,注意nagios的请求是以^nagios开头的,需要rewrite,我的配置log不报错,但是页面的cgi查询出不来
server {
listen 80;
server_name nagios.local;
access_log /var/log/nginx/nagios.access.log;
error_log /var/log/nginx/nagios.error.log info;
auth_basic "Nagios Restricted Access";
auth_basic_user_file /etc/nagios/passwd;
location / {
root /usr/share/nagios/html;
index index.php;
rewrite ^/nagios/(js|images|stylecss)/(.*)$ /$1/$2 break;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/nagios/html/$fastcgi_script_name;
}
location ~ \.cgi$ {
root /usr/lib64/nagios/cgi-bin;
rewrite ^/nagios/cgi-bin/(.*)$ /$1 break;
rewrite ^/cgi-bin/(.*)$ /$1 break;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.sock;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME /usr/lib64/nagios/cgi-bin$fastcgi_script_name;
}
}
/etc/nginx/conf.d/pnp4nagios.conf 没用alias,直接用虚拟主机方式,其他正常,仅search功能不正常
server {
listen 80;
server_name pnp4nagios.local;
access_log /var/log/nginx/pnp4nagios.access.log;
error_log /var/log/nginx/pnp4nagios.error.log info;
auth_basic "Nagios Restricted Access";
auth_basic_user_file /etc/nagios/passwd;
location / {
root /usr/share/pnp4nagios;
index index.php;
}
location ~ ^(.*\.php)(.*)$ {
root /usr/share/pnp4nagios;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
}
}
nginx下的nagios pnp4nagios的更多相关文章
- 在Nginx中搭建Nagios监控平台
本文只做Nginx下Nagiox安装的说明,其它关于Nagios监控的详细配置请参考我的另一篇文章[Ubuntu 10.04下构建Nagios监控平台] Nagios依赖PHP环境和perl环境.由于 ...
- Nagios+pnp4nagios+rrdtool 安装配置nagios(一)
基于的软件版本 Apache-2.0.63 php-5.3.2 nagios-3.2.3 nagios-plugins-1.4.15 rrdtool-1.4.5 nrpe-2.12 pnp4na ...
- 安全防范:nginx下git引发的隐私泄露问题
安全防范:nginx下git引发的隐私泄露问题 1 安全事件 最近阿里云服务器后台管理系统中收到一条安全提示消息,系统配置信息泄露: http://my.domain.com/.git/confi ...
- 如何在Nginx下配置PHP程序环境
1.nginx与PHP的关系 首先来看nginx与php的关系, FastCGI的关系(而不是像apache那样安装成nginx的模块) FastCGI的意思是, 快速的通用网关接口:CGI Comm ...
- nginx下目录浏览及其验证功能配置记录
工作中常常有写不能有网页下载东西的需求,在Apache下搭建完成后直接导入文件即可达到下载/显示文件的效果;而Nginx的目录列表功能默认是关闭的,如果需要打开Nginx的目录列表功能,需要手动配置, ...
- Nginx下css的链接问题
放在 Nginx 下的网页代码,在链接外部 css 文件时,可能出现没有链接成功的问题.需要在 nginx.conf 里的 http 下添加一行. http { include mime.types;
- Nginx下WordPress的Rewrite
最近接触WP Super Cache,该插件要求固定链接必须是重写的,故用到Rewrite. 我的是这样配置的: /usr/local/nginx/conf/rewrite/wordpress.con ...
- Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持
前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...
- ThinkPHP3.2.3 Nginx 下 URL_MODEL 的配置
ThinkPHP3.2.3 的 URL_MODEL 包括普通模式(0).PATHINFO 模式(1).REWRITE 模式(2).兼容模式(3)等 4 种 URL 模式.在 Apache 下只要在配置 ...
随机推荐
- Apache 配置 http 转 https
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{SERVER_PORT} !^443$ Rewr ...
- 洛谷 P3332 BZOJ 3110 [ZJOI2013]K大数查询
题目链接 洛谷 bzoj 题解 整体二分 Code #include<bits/stdc++.h> #define LL long long #define RG register usi ...
- restFull接口实现web
1. 模板引擎JSP的限制 在开始之前呢,我觉得我们有必要先去了解下 Spring Boot 2.0 官方文档中提到的如下内容: 模板引擎 除了REST Web服务之外,还可以使用Spring MVC ...
- nodejs的一些学习
要使用npm的时候,其实是可以直接下载node.js的.参考文档http://www.runoob.com/nodejs/nodejs-npm.html 安装成功之后.判断是否安装成功.是不能直接用n ...
- Vue添加新的响应式属性
vm.userProfile = Object.assign({}, vm.userProfile, { age: , favoriteColor: 'Vue Green' })
- 有关tensorflow一些问题
1.python版本 采用64位的python 2.系统不支持高版本tensorflow(>1.6),运行报错如下: 问题描述如下: ImportError: DLL load failed: ...
- oracle 错误实例分析(ORA-01078)
01,问题描述 心血来潮想看一下启动数据库的alert log.然后把数据库给关闭了,同时也在监听日志文件 下面可谓是详细的描述了整个关机过程,也看到了无数的error [root@node1 ...
- 解决Input number 框能够能够输入eeeeee 的问题
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))" 在input type="n ...
- 修改Android解锁界面
解锁界面效果类似如下 其实这也是我后面做出的效果,样机因为没有ROOT不好调试截图,功能是将解锁的图标添加了最近运行的运用的图标,这样的话更方便用户去使用 1.分析 1.1.Android锁屏功能分析 ...
- 周记1——WebSocket入门
一周复一周,时间过得飞快,每个周末都是很开心却又很彷徨.开心的是不用工作,彷徨的是自己这周学到了什么.自身的技能有没有提高.如何应对这个日新月异的社会... 本周的工作的开发IM(即时聊天)模块,要用 ...