王锋

王锋的博客

他的个人主页  他的博客

cacti nginx php-fpm部署到centos6.4备忘录

王锋  2013年04月16日 星期二 20:23 | 2075次浏览 | 0条评论

cacti nginx php-fpm centos

公司三台服务器,想部署个监控的软件监控一下三台centos机器的运行情况,所以就找了几个比较了一下选用cacti,好了下边介绍一下安装过程。

1.包的安装

yum -y install mysql-server php php-cli php-mysql net-snmp-utils rrdtool php-snmp gcc mysql-devel net-snmp-devel autoconf automake libtool pcre-devel openssl-devel php-fpm

mysql等设置成开机启动

chkconfig mysqld on
chkconfig crond on  #crontab
的作用
chkconfig
php-fpm on #自动运行这个是怎么回事希望自己搜索一下

2
安装cacti
现在的版本是0.8.8a
wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
tar-zxvf cacti-0.8.8a.tar.gz
cp cacti-0.8.8a /usr/local /usr/share/nginx/html -rf
cd /usr/share/nginx/html
mv cacti-0.8.8a cacti

mysql -uroot -p123456 -e "create database cacti;"

mysql -uroot -p123456 -e "GRANT ALL PRIVILEGES ON cacti.* TO  'cacti'@'127.0.0.1' IDENTIFIED BY 'cacti';"

mysql -uroot -p123456 cacti   <  /home/www/cacti/cacti.sql

3.nginx
的安装
nginx
的安装就有点繁琐了,以前源码安装老是出错,于是选择了nginxcentos源安装安装方式,安装详见 http://wiki.nginx.org/InstallChs
好了现在安装 yum install nginx

配置nginx的配置文件

删除 nginx.conf 中“pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000”部分的注释

# 删除如下部分的注释,并修改为如下的内容,

location ~ \.php$ {

        root           /usr/share/nginx/html/cacti;

        #root           /var/www/htm/cacti;

        fastcgi_pass   127.0.0.1:9001;

        fastcgi_index  index.php;

        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;

        include        fastcgi_params;

好了保存退出,

/etc/init.d/nginx restart 重启nginx

/etc/init.d/php-fpm restart确定php-fpm启动

好了现在可以访问了

http://127.0.0.1/cacti

即可访问

如果是服务器那就要 /etc/init.d/iptables stop 后在访问或者开放端口

http://host-ip /cacti 即可访问。

需要注意的几点

1我选择的是nginx的默认目录/usr/share/nginx/html,其他的我没有实验成功。

2.如果需要fastcgi的端口可以改变/etc/php-fpm.d/www.conf中的listen =

同时修改fastcgi_passnginx 127.0.0.1:9000;即可

3监控其他主机的配置请参考

http://lihuipeng.blog.51cto.com/3064864/566655

 

评论

我的评论:

发表评论

请 登录 后发表评论。还没有在Zeuux哲思注册吗?现在 注册 !

暂时没有评论

Zeuux © 2024

京ICP备05028076号