CentOS+Nginx+Nagios(安装篇)
好久没有配置这些了,感觉手有些生疏,又遇到了不少问题,记录配置过程及问题如下。所需软件:
CentOS> nagios-3.3.1.tar.gz
nagios-plugins-1.4.15.tar.gz
php-5.2.14.tar.gz
php-5.2.14-fpm-0.5.14.diff.gz
pcre-8.30.tar.gz
nginx-0.8.49.tar.gz
安装顺序:php-pcre-nginx-nagios-nagios-plugin
这个顺序是为了避免如果nginx提示需要pcre回头还要重新编译nginx。
安装PHP以及配置FASTCGI过程比较繁琐,参考了一些网上文章
[*]//安装libxml2
[*]tar zxvf libxml2-2.7.8.tar.gz
[*]cd libxml2-2.7.8
[*]./configure
[*]make
[*]make install
[*]cd ../
[*]//安装PHP
[*]gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
[*]cd php-5.2.14
[*]./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc--enable-xml --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --with-xmlrpc --enable-zip
[*]make
[*]make install
[*]//启动php-cgi,php-fpm.conf根据需要自行修改
[*]/usr/local/php/sbin/php-fpm start
[*]//安装pcre
tar zxvf pcre-8.30.tar.gz
[*]cd pcre-8.30
[*]./configure
[*]make make install
[*]//保险起见再yum 一下
[*]yum -y install pcre-devel
安装PHP前要安装libxml2,PHP参数也是参考文章后自己调整了一下,初步目的只是为了配置成功,优化的问题以后再说。
安装nginx过程比较简单
[*]tar zxvf nginx-0.8.49.tar.gz
[*]cd nginx-0.8.49
[*]./configure --without-http-cache --without-http_gzip_module
[*]make
[*]make install
安装后在nginx.conf配置中localhost后面增加如下内容
[*]location ~ .*\.(php|php5)?$
[*] {
[*] #fastcgi_passunix:/tmp/php-cgi.sock;
[*] fastcgi_pass127.0.0.1:9000;
[*] fastcgi_index index.php;
[*] include fastcgi.conf;
[*] }//启动前测试下
/usr/local/nginx/sbin/nginx -t
最后就是nagios了
[*]tar zxvf nagios-3.3.1.tar.gz
[*]cd nagios-3.3.1
[*]useradd nagios
[*]./configure --prefix=/usr/local/nagios
[*]make all
[*]make install
[*]make install-commandmode
[*]make install-config
[*]//可以配置成开机自动启动
[*]make install-init
[*]tar zxvf nagios-plugins-1.4.15.tar.gz
[*]./configure --prefix=/usr/local/nagios
[*]//注意插件的目录跟nagios是相同的,最后配置完插件在nagios的lib目录下。
页:
[1]