diff --git a/doc.md b/doc.md index 8afae69..b496ede 100644 --- a/doc.md +++ b/doc.md @@ -228,7 +228,9 @@ You're running the test on localhost, therefore it is trying to measure the spee Make sure your server is sending the ```Connection:keep-alive``` header ## Using the test without PHP -If your server does not support PHP, or you're using something newer like Node.js, you can still use this test by replacing `garbage.php`, `empty.php` and `getIP.php` with equivalents. +If your server **does not support PHP**, maybe you have only **nginx** for static files, or you're using something newer like **Node.js**, you can still use this test by replacing `garbage.php`, `empty.php` and `getIP.php` with equivalents. + +For **nginx** see comments below and [example 9](example9_no_backend.html#L115) ### Replacements @@ -241,12 +243,34 @@ If you're using Node.js or some other server, your replacement should accept the It is important here to turn off compression, and generate incompressible data. A symlink to `/dev/urandom` is also ok. +**nginx** +Use tool above to generate static known file size. Upload to server so it is available something like `/speedtest/20MB.file` + + #### Replacement for `empty.php` Your replacement must simply respond with a HTTP code 200 and send nothing else. You may want to send additional headers to disable caching. The test assumes that Connection:keep-alive is sent by the server. +**nginx** +1. Increase allowed POST body size +2. Create empty text file `empty.file` +3. Allow HTTP POST method to static/empty file and return HTTP 200 even nothing is saved or processed by server +```nginx +location /speedtest/empty.file { + client_max_body_size 30M; + error_page 405 =200 $uri; +} +``` + #### Replacement for `getIP.php` Your replacement must simply respond with the client's IP as plaintext. Nothing fancy. +**nginx** +```nginx +location /speedtest/getip { + return 200 $remote_addr; +} +``` + #### JS You need to start the test with your replacements like this: diff --git a/empty.file b/empty.file new file mode 100644 index 0000000..49cc8ef Binary files /dev/null and b/empty.file differ diff --git a/example9_no_backend.html b/example9_no_backend.html new file mode 100644 index 0000000..ed6834a --- /dev/null +++ b/example9_no_backend.html @@ -0,0 +1,122 @@ + + +
+ + + ++ Speedtest + + +
++ Your IP: +
++
Mbit/s
++
Mbit/s
++
ms
++
ms
+