搭建一个librespeed测速服务器

背景

有的时候需要一个测速服务器方便测速,自己搭建一个比较方便

搭建方法

https://github.com/librespeed/speedtest

项目地址

实际上就是基于一个web服务器然后做的,并且使用了php

建议使用httpd比较方便

1
2
3
yum install httpd
yum search php8
yum localinstall remi-release-9.rpm

如果官方源里面的php版本提示低了,可以从remi里面下载

拷贝项目代码

1
2
3
4
5
cp -ra speedtest-5.4.1/index.html /var/www/html
cp -ra speedtest-5.4.1/backend/
cp -ra speedtest-5.4.1/results/
cp -ra speedtest-5.4.1/*.js
chmod 755 -R /var/www/html/

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[root@VM-0-13-centos speedtest-5.4.1]# cat /var/www/html/results/telemetry_settings.php
<?php

// Type of db: "mssql", "mysql", "sqlite" or "postgresql"
$db_type = 'sqlite';
// Password to login to stats.php. Change this!!!
$stats_password = 'PASSWORD';
//避免猜测url
// If set to true, test IDs will be obfuscated to prevent users from guessing URLs of other tests
$enable_id_obfuscation = True;
//可以隐藏ip和isp信息
// If set to true, IP addresses will be redacted from IP and ISP info fields, as well as the log
$redact_ip_addresses = false;

// Sqlite3 settings
$Sqlite_db_file = '/var/www/speedtest_telemetry.db';

// mssql settings
$MsSql_server = 'DB_HOSTNAME';
$MsSql_databasename = 'DB_NAME';
$MsSql_WindowsAuthentication = true; //true or false
$MsSql_username = 'USERNAME'; //not used if MsSql_WindowsAuthentication is true
$MsSql_password = 'PASSWORD'; //not used if MsSql_WindowsAuthentication is true
$MsSql_TrustServerCertificate = true; //true, false or comment out for driver default
//Download driver from https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver16

// Mysql settings
$MySql_username = 'USERNAME';
$MySql_password = 'PASSWORD';
$MySql_hostname = 'DB_HOSTNAME';
$MySql_databasename = 'DB_NAME';
$MySql_port = '3306';

// Postgresql settings
$PostgreSql_username = 'USERNAME';
$PostgreSql_password = 'PASSWORD';
$PostgreSql_hostname = 'DB_HOSTNAME';
$PostgreSql_databasename = 'DB_NAME';

注意简单点就直接用sqlite就可以了,这个会记录一些测试的信息,设置下密码

配置好了以后启动httpd即可使用了


搭建一个librespeed测速服务器
https://zphj1987.com/2025/12/24/搭建一个librespeed测速服务器/
作者
zphj1987
发布于
2025年12月24日
许可协议