The title says it all. I’ve created a Youtube video to accompany this guide. Watch it here. Before we start, please find out if you are running a program on your PC that is using port 80 (a webserver). If you do, disable it, or else Nginx will have a conflict with that program since only one process can use a port.
Let’s download the latest release from the github first: github.com/ustoopia/Live-stream-server-portable-Windows-Nginx-RTMP-HLS-Dash/releases. Unzip the contents of the zip file anywhere you prefer. In the example video I choose C:\livestream.
Open Windows Powershell and run it as administrator. Enter the commands below but edit them if you’ve chosen a different location.
dir C:\livestream -Recurse | Unblock-File dir C:\livestream\extras -Recurse | Unblock-File
Now run the “test-config.bat” file to see if Nginx finds any errors or not.
If you see the above message, then everything is good and you can proceed by double-clicking “NGINX.exe“. When you do, it might seem as if nothing is happening but when you check your task-manager you’ll see that Nginx has now two processes running. Open your web-browser and go to localhost/ to confirm that you will see a default Nginx page there. To test if streaming is also working start up your live-stream client and edit the settings of the server you want to stream to. Make sure it says: s with live-stream key: stream. Now start streaming!
Have a look at the statistics page at localhost/stat to see if all the streams are good. That concludes the basic first step of this guide. If you are happy using it like this, go right ahead! But before you make this decision I want to inform you of the following;
Creating the HLS and Dash streams is done by writing many video fragments of the stream to your hard drive. Shortly after they get deleted again. If this happens a lot (for example you stream 24/7) then you will probably want to move the folder it uses to write these files to, to use an external USB drive. Why?? Because the many read/writes will shorten the lifespan of your drive, and especially if it’s an SSD drive. So best practice would be to use any drive but the C drive. Your best option is to use a USB drive or memory stick of > 2gb.
Open the folder that contains the Nginx.exe file from the downloaded file and copy the “temp” folder there. Paste it on a separate drive in some folder. Now open the conf/nginx.conf file using notepad. Search all the lines that show something like this: variable temp/tmp_hls. Now change the location to where you pasted the temp folder earlier on. So for example: change “temp/tmp_hls” to “F:/just/a/folder/temp/tmp_hls” and save the file. Don’t forget to stop/start the nginx process to implement the changes.
You are done! Your video fragment files will now be written to the external USB drive. You could have some web player read these files from that location and use them to show your live-stream in HLS on your website.
Good luck! And leave any questions in the comments or contact me directly.