mirror of
https://github.com/librespeed/speedtest.git
synced 2026-05-13 08:16:36 +00:00
Page:
Reverse proxy with Nginx
Pages
Alternative backends
Browser support
CentOS 8 installation guide
Contributing
Home
Implementation details
Installation (Go)
Installation (Node.js)
Installation (PHP)
Installation (PHP with Docker)
Installation
Making a custom front end
Multiple test points (PHP)
Nginx vHost for PHP version
No backend
Reverse proxy with Apache
Reverse proxy with Nginx
Troubleshooting, common problems, known limitations
Using PM2 to keep the Node Server running
Using prebuilt NodeJS Binaries
backend files
results files
speedtest.js
speedtest_worker.js
No results
3
Reverse proxy with Nginx
Perflyst edited this page 2020-03-23 12:15:37 +01:00
To expose the locally running service to the internet you need to configure a reverse proxy. Depending on how you run the service (Docker, Go binary) you need to change the port in the config below.
You also need to obtain a SSL certificate from for example Let's Encrypt with certbot.
IPv4 and IPv6 is intentionally separate, otherwise it is not possible to forward the IPv6 address from the client to the backend. If you do not have IPv6 please remove the IPv6 blocks from the virtual host below.
# IPv4 plain HTTP
server {
listen 80;
server_name librespeed.example.org;
access_log /dev/null;
error_log /dev/null;
location / {
proxy_pass http://127.0.0.1:<port>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
client_max_body_size 21M;
}
# IPv6 plain HTTP
server {
listen [::]:80;
server_name librespeed.example.org;
access_log /dev/null;
error_log /dev/null;
location / {
proxy_pass http://[::]:<port>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
client_max_body_size 21M;
}
# IPv4 encrypted HTTPS
server {
listen 443 ssl http2;
server_name librespeed.example.org;
access_log /dev/null;
error_log /dev/null;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_trusted_certificate /path/to/chain.pem;
location / {
proxy_pass http://127.0.0.1:<port>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
client_max_body_size 21M;
}
# IPv6 encrypted HTTPS
server {
listen [::]:443 ssl http2;
server_name librespeed.example.org;
access_log /dev/null;
error_log /dev/null;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_trusted_certificate /path/to/chain.pem;
location / {
proxy_pass http://[::]:<port>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
client_max_body_size 21M;
}