红联Linux门户
Linux帮助

CentOS安装配置PHP Server Monitor

发布时间:2016-10-17 12:05:28来源:topspeedsnail.com作者:斗大的熊猫
PHP Server Monito是开源的基于Web的监控工具,它可检测服务器健康状态,可通过Web接口管理后台服务。
主页:http://www.phpservermonitor.org/
PHP Server Monitor源代码:https://github.com/phpservermon/phpservermon
 
CentOS 安装 PHP Server Monitor
 
1、安装LAMP(或LEMP)
yum install httpd mariadb-server php php-curl php-cli php-mysql php-pdo php-common
启动apache和mysql/mariadb服务:
systemctl start mariadb.service
systemctl start httpd.service
运行MariaDB初始化安全脚本(默认密码为空):
mysql_secure_installation
 
2、为phpservermon创建数据库
mysql -u root -p
MariaDB [(none)]> create database phpservermon;
MariaDB [(none)]> grant all on phpservermon.* to 'phpmonitor'@'localhost' identified by 'test1234';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
上面的SQL语句创建了一个phpservermon数据库和phpmonitor用户(密码test1234)。
 
3、下载phpservermon源码:http://www.phpservermonitor.org/download/
cd /var/www/html/
wget https://sourceforge.net/projects/phpservermon/files/phpservermon/PHP%20Server%20Monitor%20v3.1.1/phpservermon-3.1.1.tar.gz
解压:
tar -xvzf phpservermon-3.1.1.tar.gz
mv phpservermon-3.1.1 phpservermon
更改目录权限:
chown -R apache:apache /var/www/html/phpservermon
 
4、创建Apache虚拟主机配置文件
vim /etc/httpd/conf.d/phpsrvmon.conf
写入内容:
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName your_domain.com
ServerAdmin you@example.com
ErrorLog "/var/log/httpd/phpservermon-error_log"
TransferLog "/var/log/httpd/phpservermon-access_log"
<Directory />
Options +Indexes
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
注意替换上面的域名。
 
4、配置PHP
设置时区:
vim /etc/php.ini
date.timezone = Asia/Taipei
可用的时区参考:http://www.php.net/manual/en/timezones.php
重启Apache:
systemctl restart httpd
 
5、完成安装
使用浏览器访问:http://your_server_domain/phpservermon
CentOS安装配置PHP Server Monitor
设置数据库连接:
CentOS安装配置PHP Server Monitor
如果出现文件不可写,执行如下命令手动创建文件:
vim /var/www/html/phpservermon/config.php
<?php
define('PSM_DB_HOST', 'localhost');
define('PSM_DB_NAME', 'phpservermon');
define('PSM_DB_USER', 'phpmonitor');
define('PSM_DB_PASS', 'test1234');
define('PSM_DB_PREFIX', 'psm_');
添加用户:
CentOS安装配置PHP Server Monitor
安装完成:
CentOS安装配置PHP Server Monitor
 
本文永久更新地址:http://www.linuxdiyf.com/linux/25118.html