pi-dashboard 测试

pi-dashboard 测试

centos7 安装php7.3

CentOS 7 yum安装 PHP7.3 教程

yum install epel-release

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm  

yum install yum-utils

yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll


systemctl enable php73-php-fpm
systemctl start php73-php-fpm

[root@localhost html]# php73 -v
PHP 7.3.22 (cli) (built: Sep  1 2020 09:44:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.22, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.22, Copyright (c) 1999-2018, by Zend Technologies


php-fpm 启动后,默认的服务端口号为9000端口。

[root@localhost php-fpm.d]# systemctl status php73-php-fpm
● php73-php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php73-php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2020-09-27 02:50:10 EDT; 14min ago
 Main PID: 10998 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 10, slow: 0, Traffic: 0req/sec"
    Tasks: 6
   Memory: 21.7M
   CGroup: /system.slice/php73-php-fpm.service
           ├─10998 php-fpm: master process (/etc/opt/remi/php73/php-fpm.conf)
           ├─10999 php-fpm: pool www
           ├─11000 php-fpm: pool www
           ├─11001 php-fpm: pool www
           ├─11002 php-fpm: pool www
           └─11003 php-fpm: pool www

Sep 27 02:50:10 localhost.localdomain systemd[1]: Starting The PHP FastCGI Process Manager...
Sep 27 02:50:10 localhost.localdomain systemd[1]: Started The PHP FastCGI Process Manager.

查看 /etc/opt/remi/php73/php-fpm.conf/etc/opt/remi/php73/php-fpm.d/www.conf 文件,发现是在 /etc/opt/remi/php73/php-fpm.d/www.conf 中对 php-fpm的服务端口进行配置的。

[root@localhost php-fpm.d]# cat /etc/opt/remi/php73/php-fpm.d/www.conf |grep 9000
listen = 127.0.0.1:9000

配置 nginx

编写 phpinfo() 测试文件

在 /usr/local/nginx/html/ 目录下,编写 phptest.php 文件 。

<?php
phpinfo()
?>

配置nginx


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        root /usr/local/nginx/html/;
        location / {
            #root   html;
            index  index.html index.htm index.php default.html default.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            #root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
			# 注意一下 SCRIPT_FILENAME 这个参数的配置
            fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }


    }

}

启动 nginx

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx-pidashboard.conf -s stop
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx-pidashboard.conf 

在 centos7 上测试运行pi-dashboard

从 github 上面获取 pi-dashboard的源代码,pi-dashboard
这是一个使用php编写的树莓派web监控平台,我们也可以将这套代码尝试着运行在x86的centos7上面,查看其前端web实现。

将github上下载的源代码全部拷贝到 /usr/local/nginx/html/ 目录下。
修改 index.php 为 pi.php。

  mv index.php pi.php

浏览器访问测试

部署完成后,整个目录文件如下所示。

[root@localhost html]# pwd
/usr/local/nginx/html
[root@localhost html]# tree
.
├── 50x.html
├── assets
│   ├── bootstrap.min.css
│   ├── bootstrap.min.js
│   ├── dashboard.js
│   ├── dashboard.min.js
│   ├── devices
│   │   └── raspberry-pi.png
│   ├── exporting.js
│   ├── highcharts.js
│   ├── highcharts-more.js
│   ├── jquery-3.1.1.min.js
│   ├── logo.png
│   └── solid-gauge.js
├── bigdata.html
├── device.php
├── favicon.ico
├── index.html
├── phptest.php
├── pi.php
├── subreq
└── subreqco

2 directories, 20 files

浏览器访问web路径 http://192.168.7.73/pi.php,即可看到如下界面。

pi-dashboard

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飘雪冰峰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值