Table of Contents#
- What You'll Need
- Understanding the Components
- Step 1: Preparing Your Server Environment
- Step 2: Installing the Speedtest Server (Docker Method)
- Step 3: Configuring Your Network (Port Forwarding)
- Step 4: Accessing and Using Your Speedtest Server
- Step 5: Advanced Configuration (Optional)
- Troubleshooting Common Issues
- Conclusion
- References
What You'll Need#
Before we begin, ensure you have the following:
- A Server Machine: This can be:
- A physical computer or a virtual machine running on your local network (e.g., a home server, an old PC, or a Raspberry Pi).
- A Virtual Private Server (VPS) from a cloud provider like DigitalOcean, Linode, Vultr, or AWS. This is often the best option as it provides a stable, high-speed endpoint outside your local network.
- A Supported Operating System: The server should run a mainstream Linux distribution like Ubuntu 20.04/22.04 LTS or Debian 11/12. This guide will use Ubuntu as an example.
- Basic Command Line Knowledge: You need to be comfortable using a terminal (SSH for remote servers).
- Docker and Docker Compose: We will use Docker for a simple, containerized installation. (Installation instructions are included).
- Network Access: You must be able to access the server's IP address from the client machine you wish to test from. If the server is on your local network, this is straightforward. If it's on a remote VPS, you'll need a public IP.
- Domain Name (Optional but Recommended): For a professional setup, especially on a VPS, having a domain name pointed to your server's IP address is ideal. You can obtain a free one from services like Freenom or use a subdomain from a domain you already own.
Understanding the Components#
A self-hosted speed test consists of two main parts:
- The Server: This is the software installed on your machine (the one we are setting up). Its job is to receive data from the client, send data back, and calculate the speed based on how quickly this data is transferred. We are using the
librespeedserver component. - The Client: This is the web interface or application you use to initiate the test. When you go to your server's IP address or domain name in a web browser, you are using the client to communicate with the server.
Step 1: Preparing Your Server Environment#
First, connect to your server via SSH (if remote) or open a terminal (if local).
1. Update the System: Always start by updating your package lists and upgrading existing packages.
sudo apt update && sudo apt upgrade -y2. Install Docker:
The easiest way to run librespeed is via a Docker container. Install Docker using the official convenience script.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh3. Add Your User to the Docker Group (Optional but Recommended):
This allows you to run Docker commands without sudo.
sudo usermod -aG docker $USERImportant: You must log out and log back in for this group membership to take effect.
4. Install Docker Compose: Docker Compose helps manage container configurations easily.
sudo apt install docker-compose-plugin -yVerify the installation with docker compose version.
Step 2: Installing the Speedtest Server (Docker Method)#
We'll create a dedicated directory and a docker-compose.yml file to manage our service.
1. Create a Project Directory:
mkdir ~/librespeed && cd ~/librespeed2. Create the Docker Compose File:
Use a text editor like nano to create the file.
nano docker-compose.yml3. Paste the Following Configuration:
This configuration uses the official librespeed/speedtest image and sets it up to run on port 80 (the default HTTP port).
version: '3.8'
services:
speedtest:
image: librespeed/speedtest:latest
container_name: librespeed
restart: unless-stopped
ports:
- "80:80"
environment:
- TZ=UTC # Set your timezone, e.g., America/New_York
# Uncomment the line below if you want to enable telemetry (not recommended for private use)
# - ENABLE_ID_OBFUSCATION=truerestart: unless-stopped: Ensures the container automatically restarts if the server reboots or the container crashes.ports: "80:80": Maps port 80 on your server to port 80 inside the container.TZ: Set your correct timezone for proper logging.
Save and close the file (in nano, press Ctrl+X, then Y, then Enter).
4. Start the Speedtest Server:
Run the following command from within your ~/librespeed directory:
docker compose up -dThe -d flag runs the container in "detached" mode, meaning it runs in the background.
5. Verify the Container is Running:
docker psYou should see a container named librespeed with a status of "Up".
Step 3: Configuring Your Network (Port Forwarding)#
If your server is on a Local Network (e.g., at home):
To test your internet speed from outside your network (e.g., from your phone using cellular data), you need to forward port 80 on your router to the local IP address of your server.
- Find your server's local IP address:
ip addr showorhostname -I. - Log into your router's administration panel (usually
192.168.1.1or192.168.0.1). - Find the "Port Forwarding" or "NAT" section.
- Create a new rule:
- External Port: 80
- Internal IP Address: [Your server's local IP, e.g., 192.168.1.100]
- Internal Port: 80
- Protocol: TCP
If your server is a VPS (Cloud Server):
Cloud providers often have a firewall. You need to open port 80.
- For DigitalOcean: Go to your project's "Networking" tab and create a firewall rule allowing inbound TCP traffic on port 80.
- For AWS: Modify the "Security Group" associated with your VPS to allow inbound HTTP (port 80) traffic from
0.0.0.0/0(everywhere) or your specific IP.
Step 4: Accessing and Using Your Speedtest Server#
Now for the exciting part! Open a web browser on any device connected to the internet.
- If testing internally (client and server on same network): Go to
http://[SERVER-LOCAL-IP](e.g.,http://192.168.1.100). - If testing from the internet: Go to
http://[YOUR-SERVER-PUBLIC-IP]orhttp://your-domain.comif you set up a domain.
You should see the clean, familiar Librespeed interface. Click "START" to begin the test. It will measure your Ping (latency), Jitter, Download, and Upload speeds.
Important Note: If you are testing from a client inside the same network as the server, the test will primarily measure the speed of your local network (Wi-Fi/Ethernet), not your full internet connection. For a true internet speed test, have the client on a different network (e.g., use your phone's cellular data).
Step 5: Advanced Configuration (Optional)#
Using a Reverse Proxy with SSL (HTTPS): Exposing your server on port 80 (HTTP) is insecure. It's highly recommended to use a reverse proxy like Nginx Proxy Manager or Traefik to add SSL encryption (HTTPS).
Here's a basic docker-compose.yml example adding Nginx Proxy Manager:
version: '3.8'
services:
speedtest:
image: librespeed/speedtest:latest
container_name: librespeed
restart: unless-stopped
networks:
- proxy-network # Custom network for communication
# Remove the ports section, the proxy will handle external traffic
nginx-proxy:
image: jc21/nginx-proxy-manager:latest
restart: unless-stopped
ports:
- "80:80" # Public HTTP port
- "443:443" # Public HTTPS port
- "81:81" # Admin interface port
networks:
- proxy-network
volumes:
- ./proxy-data:/data
- ./proxy-letsencrypt:/etc/letsencrypt
networks:
proxy-network:
driver: bridgeAfter running this, you would access the Nginx Proxy Manager admin panel at http://[your-server-ip]:81, create a proxy host pointing to the librespeed container, and request a free SSL certificate from Let's Encrypt.
Troubleshooting Common Issues#
- "Connection Refused" Error:
- Check if the Docker container is running:
docker ps. - Check if the firewall on your server is blocking port 80 (e.g.,
ufw statuson Ubuntu; you may needsudo ufw allow 80). - Verify your port forwarding or cloud firewall rules.
- Check if the Docker container is running:
- Test Results are Much Higher/Lower Than Expected:
- Local Test: Remember, testing from within the same network measures LAN speed, not WAN (internet) speed.
- Server Bottleneck: If your server (especially a VPS) has limited resources (CPU, network I/O), it can become a bottleneck and show lower speeds. Use a well-provisioned VPS.
- Geographical Distance: A test from New York to a server in Singapore will have higher latency and potentially lower speeds due to distance.
- Docker Command Not Found:
- Revisit the Docker installation steps. Ensure you logged out and back in after adding your user to the
dockergroup.
- Revisit the Docker installation steps. Ensure you logged out and back in after adding your user to the
Conclusion#
Congratulations! You have successfully set up your own private Speedtest Mini Server. You now have a powerful tool to measure your internet bandwidth with precision, free from the variables of public speed test services. This is invaluable for verifying ISP claims, troubleshooting network issues, and maintaining control over your data.
You can further customize your server by exploring the librespeed documentation, changing the look and feel, or even setting up multiple servers in different locations for a more comprehensive testing suite. Happy testing!
References#
- Librespeed Official Website: https://librespeed.org/
- Librespeed GitHub Repository: https://github.com/librespeed/speedtest
- Docker Official Documentation: https://docs.docker.com/
- Nginx Proxy Manager Documentation: https://nginxproxymanager.com/