91 Monitor
示例站点: demo.91monitor.com (不安装的情况下,无法使用管理员账号登录,只能注册后使用)
91 monitor是一款专门为监控服务器状态的PHP开源系统。 特点概述:支持监听各种服务器端口,以及web站点 , 并且支持终端控制
环境
PHP版本5.5.9以上(扩展:OpenSSL PHP Extension,PDO PHP Extension,Mbstring PHP Extension)
Linux服务器
Composer 工具
MySQL 5.6以上
已提前部署好宝塔LNMP运行环境,使用Nginx 1.14 + MySQL 5.6 +php 5.6
网站站点根路径:/www/wwwroot/monitor.sirlongtao.top
第一步克隆
克隆项目(确保有github账号,并且本地公钥已经在github账户,否则无法克隆,你也可以选择https方式的下载)
git clone [email protected]:123jixinyu/monitor.git
本人选择https方式的下载的程序安装包
第二步安装
注意:第二步过程可使用脚本安装,项目根目录执行: sudo sh 91monitor_install.sh,也可按照下面的方法一步步安装(建议)
安装laravel依赖 进入项目根目录,例如我的网站目录为/www/wwwroot/monitor.sirlongtao.top
cd /www/wwwroot/monitor.sirlongtao.top
composer install
报错一:
[Symfony\Component\Process\Exception\RuntimeException]
The Process class relies on proc_open, which is not available on your PHP installation.
请检查检查php配置文件中disable_functions 是否设置了proc_open函数禁用,如果禁用请将函数proc_open在禁用函数中剔除。
报错二:
[ErrorException]
proc_get_status() has been disabled for security reasons
请检查检查php配置文件中disable_functions 是否设置了proc_get_status函数禁用,如果禁用请将函数proc_get_status在禁用函数中剔除。
需要更新一下版本,版本太老,获取不到组件
命令:
composer update
更新完成后再安装就可以顺利完成,如图:
在根目录新建.env文件并将.env.example文件内容复制到.env,并修改.env配置,建立相应数据库
cd /www/wwwroot/monitor.sirlongtao.top
cp .env.example .env
建立数据库(例如新建一个名为monitor的数据库)
数据库名:monitor
数据库用户名:monitor_user
数据库密码:monitor_password
修改.env 文件 配置数据库连接,分别是数据库类型、数据库地址、数据库名、数据库用户名、数据库密码。
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=monitor
DB_USERNAME=monitor_user
DB_PASSWORD=monitor_password
配置邮箱,分别是发件服务器类型,发件地址,发件端口,发件邮箱,发件邮箱密码,发件邮件加密类型(以下是QQ邮箱示例)
MAIL_DRIVER=smtp
MAIL_HOST=smtp.qq.com
MAIL_PORT=465
MAIL_PASSWORD=123456
MAIL_ENCRYPTION=ssl
调试模式,true为开启,false为关闭
APP_DEBUG=true
到项目根目录运行artisan命令初始化表以及生成应用key
cd /www/wwwroot/monitor.sirlongtao.top
php artisan migrate
php artisan key:generate
初始化基本数据
cd /home/wwwroot/monitor
composer dump-autoload
php artisan db:seed
第三步 配置nginx(示例配置)
配置nginx映射到public 目录下,并且设置storage以及bootstrap目录读写权限。在public 目录下创建名为uploads的文件夹并赋予写入权限
server
{
listen 80;
server_name monitor.sirlongtao.top;
index index.html index.htm index.php;
root /home/wwwroot/monitor/public;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
#location / {
# allow all;
# rewrite ^(.*)$ /index.php;
#}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /uploads{
allow all;
}
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
allow all;
}
access_log /home/wwwlogs/access.log;
}
第四步
将/www/server/php/56/bin/php /www/wwwroot/monitor.sirlongtao.top/artisan schedule:run 加到crontab中去,其中www/wwwroot/monitor.sirlongtao.top是你的项目目录。(/usr/bin/php是我的服务器php可执行文件路径,这里你们写自己的路径)
* * * * * /www/server/php/56/bin/php /www/wwwroot/monitor.sirlongtao.top/artisan schedule:run
安装后默认登录账户为[email protected] 密码123456(不安装情况下无法使用该账号)