文章目录
项目开源地址:
https://github.com/adolfintel/speedtest
安装并启动speedtest
yum install httpd php git -y
git clone https://github.com/adolfintel/speedtest.git
cd speedtest/
cp -R backend/ example-singleServer-pretty.html *.js /var/www/html/
cd /var/www/html/
mv example-singleServer-pretty.html index.html
chown -R apache * #更改当前的目录所属主
systemctl start httpd
http:/hostip #访问主机ip就可以测速了
让测试数据持久化(保存至数据库中)
安装数据库,导入数据,将测试的结果保存以便后续查询
安装mariadb数据库
yum install mariadb-server -y
systemctl start mariadb
mysql_secure_installation
mysql -uroot -p
create database speedtest;
exit;
权限调整,并修改telemetry设置文件
cd /root/speedtest/
cp -R results/ /var/www/html/
cd /var/www/html/
chown -R apache *
cd /var/www/html/results/
++++++++++++
vi /var/www/html/results/telemetry_settings.php
$stats_password="admin"; //password to login to stats.php. Change this!!!
$enable_id_obfuscation=true; //if set to true, test IDs will be obfuscated to prevent users from guessing URLs of other tests
// Mysql settings
$MySql_username="root";
$MySql_password="12456";
$MySql_hostname="localhost";
$MySql_databasename="speedtest";
++++++++++++++++++++++++++++++++++++++++++++
导入数据库
mysql -uroot -p speedtest < /var/www/html/results/telemetry_mysql.sql
cd /var/www/html/
cp ~/speedtest/example-singleServer-full.html index.html
登录查询
这样测试的数据都会记录到数据库中,下面是登录网站,密码是上面($stats_password="admin";)中指定的
http://xxx.xxx.com/results/stats.php
如果文章对你有帮助,欢迎点击上方按钮打赏作者
暂无评论