[cacti]nginx+php+cacti+mysql+php-fpm 安装小记
网上教程很多,但是nginx不太多,下面安装时候主要参考的篇文章:
http://54im.com/linux/linux-cacti-cn-install.html
http://www.tecmint.com/install-cacti-network-monitoring-on-rhel-centos-6-3-5-8-and-fedora-17-12/ 主要
http://tongcheng.blog.51cto.com/6214144/1627590 流水账
http://better.blog.51cto.com/1886029/1199143 源码安装
用到的服务有mysql nginx net-snmp php acati php-fpm 还有各种安装包,安装的环境是 Centos6.5
我这边一般的mysql nginx都是安装好的,主要是php 安装不熟悉
net-snmp, rrdtool 安装
# yum install rrdtool net-snmp net-snmp-libs net-snmp-utils
php 以及依赖的包
# yum install php php-mysql php-snmp php-xml php-gd php-pear php-common php-devel php-mbstring php-cli php-fpm
mysql 用户和数据库建立
mysql>create database cacti default character set utf8;
mysql>GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON cacti.* TO cacti@'%' IDENTIFIED BY 'cacti#erya';
mysql>flush privileges;
安装cacti
# mkdir /www
# cd /www/
# wget -c http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz
# tar zxvf cacti-0.8.8c.tar.gz
# mv cacti-0.8.8c cacti
# mysql -ucacti -pcacti#erya -Dcacti < cacti/cacti.sql
修改数据库配置
# vim /www/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti#erya";
$database_port = "3306";
$database_ssl = false;
还有要改时区,否则画出来的图时间轴不对。还是php.ini设置的好
date.timezone = Asia/Shanghai
添加nginx web用户和权限,这里没做,不过可以后来修改
还有设置开机启动等
添加nginx配置,重启nginx php-fpm 等
server {
listen 8080;
server_name localhost;
root /www/cacti;
location /cacti {
alias /www/cacti;
index index.php;
}
location ~ ^/cacti.+\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^/cacti(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /www/cacti/$fastcgi_script_name;
include fastcgi.conf;
}
}
没搞明白这个配置,但是可以使用
添加定时任务
#vim /etc/cron.d/cacti
*/5 * * * * /usr/bin/php /www/cacti/poller.php > /dev/null 2>&1
到这里基本就安装完毕了。
测试nginx ,php是否好用,这里用fastcgi吧,只是界面
[root@MiWiFi-R1D html]# cat index.php
<?php
phpinfo();
?>
这里的问题就是php怎么启动,nginx配置fastcgi很容易,但是php容器需要安装和重新编译
继续安装
# yum install php-fpm
这是一个服务,还需配置
主配置文件 /etc/php-fpm.conf 子配置文件在 php-fpm.d/
# /etc/init.d/php-fpm start
正在启动 php-fpm: [确定]
nginx配置文件
server {
listen 8080;
server_name localhost;
root html;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
然后访问 http://192.168.31.206:8080/可以看到php信息,不太懂怎么找到php文件路径的
错误
如果出现了下面的错误
2015/05/22 16:06:33 [error] 30521#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in /home/www/cacti/lib/adodb/adodb.inc.php on line 833" while reading response header from upstream, client: 103.254.64.163, server: localhost, request: "GET /cacti/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "124.88.61.42:8890"
可能是没有初始化数据库的原因
声明:
本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/45954663 作者orangleliu 采用署名-非商业性使用-相同方式共享协议
[cacti]nginx+php+cacti+mysql+php-fpm 安装小记的更多相关文章
- MySQL 社区版 安装小记
根据刘铁猛老师的教程,自己折腾一下 1. 安装包准备 在Windows10 64bit上安装,故需要准备vc++ 2013和2015的Redistributable的包,搜索即有,无需细说. 示例数据 ...
- linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
1首先这是基于lnmp模式进行的 2yum安装 yum -y install httpd mysql mysql-server php php-mysql php-json php-pdo 3lib库 ...
- CentOS 7 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)
原文 CentOS 7 下安装 LEMP 服务(nginx.MariaDB/MySQL 和 php) LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作 ...
- CentOS 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)
转载自:https://linux.cn/article-4314-1.html 编译自:http://xmodulo.com/install-lemp-stack-centos.html 作者: D ...
- Ubuntu14.04(nginx+php+mysql+vsftp)配置安装流程
Ubuntu14.04(nginx+php+mysql+vsftp)配置安装流程 1.先切换到root用户 sudo su 2.更新软件源 apt update apt-get upgrade 3. ...
- Linux下的python3,virtualenv,Mysql、nginx、redis等常用服务安装配置
Linux下的python3,virtualenv,Mysql.nginx.redis等常用服务安装配置 学了前面的Linux基础,想必童鞋们是不是更感兴趣了?接下来就学习常用服务部署吧! 安装环 ...
- [转载]CentOS 下安装LEMP服务(Nginx、MariaDB/MySQL和PHP)
LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作用.正如其名称所暗示的, LEMP 包是由 Linux.nginx.MariaDB/MySQL 和 P ...
- centos7 配置 zabbix 3 & apache , nginx 与php, mysql 的交互(基本)
#yum install -y https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-server-mysql-3.0.0 ...
- Linux下python3、virtualenv、Mysql、redis安装配置
一.在Linux安装python解释器 1.下载python3源码包 cd /opt/ wget https://www.python.org/ftp/python/3.6.2/Python-3.6. ...
随机推荐
- Codeforces Round #430 D. Vitya and Strange Lesson
Today at the lesson Vitya learned a very interesting function - mex. Mex of a sequence of numbers is ...
- Python Django的分页,Form验证,中间件
本节内容 Django的分页 Form 中间件 1 Django 分页 1.1 Django自带的分页 1.首先来看下我的测试数据环境 ############ models.py ######### ...
- 开发者说 | 使用Visual Studio Code编译、调试Apollo项目
转载地址:https://mp.weixin.qq.com/s?__biz=MzI1NjkxOTMyNQ==&mid=2247484266&idx=1&sn=d6bcd4842 ...
- oracle之子查询、创建用户、创建表、约束
子查询 子查询可以分为单行子查询和多行子查询 单行子查询 [1] 将一个查询的结果作为另外一个查询的条 ...
- webpack require.ensure 按需加载
使用 vue-cli构建的项目,在 默认情况下 ,会将所有的js代码打包为一个整体比如index.js.当使用存在多个路由代码的时候,index.js可能会超大,影响加载速度. 这个每个路由页面除了i ...
- JVM之Java虚拟机详解
这篇文章解释了Java 虚拟机(JVM)的内部架构.下图显示了遵守Java SE 7 规范的典型的 JVM 核心内部组件. 上图显示的组件分两个章节解释.第一章讨论针对每个线程创建的组件,第二章节讨论 ...
- Python小代码_2_格式化输出
Python小代码_2_格式化输出 name = input("name:") age = input("age:") job = input("jo ...
- 用CSS让DIV上下左右居中的方法
转载自喜欢JS的无名小站 例如 一个父div(w:100%;h:400px)中有一个子div(w:100px;100px;).让其上下左右居中. 方法一(varticle-align) 理念 利用表格 ...
- CodeBlocks使用小技巧
1.基本使用: CodeBlocks使用介绍 2.一定要建项目才能编译运行代码吗? 不一定,也可以直接新建文件,直接运行. 如何管理这些未纳入项目的文件?通过左侧Management面板,切换到Fil ...
- 更新git源以便安装最新版本
sudo add-apt-repository ppa:git-core/ppa sudo apt-get update