This is a project that allows you to create a url that can be used to share files on your local are network or across the internet with advanced setup, simple to use just running the script on a terminal window setting the root path, port and runtime else default to current path, a random dynamic port and 15 minutes as runtime.
NOTE: Ensure you have python and git installed before you continue, no additional python modules are required. I'll also be assuming you are doing everything from a terminal window.
- Clone the repo and move into the directory.
git clone https://github.com/thread101/simple-home-lab-web-host.git
cd simple-home-lab-web-host/NAS-server- Run the script
NAS-server.py.
# Unix/Linux/Macs run
python3 NAS-server.py# ms windows
python NAS-server.pyThis will create a url to the current directory with a random dynamic port and run for 15 minutes.
- On Linux you can also run.
chmod +x NAS-server.py
./NAS-server.py- The script also takes parameters.
path,portandruntimerespectively.
# Unix/Linux/Macs run
python3 NAS-server.py /home/ 8080 10# ms windows
python NAS-server.py C: 8080 10This takes the path parameter followed by the port and finally the runtime in minute, time can also be taken as floating point.
-
To open the link from another machine on your local area network just find your device's ip address and replace
localhostwith your ip say192.168.43.136tohttp://192.168.43.136:8080. -
You can visit the link and you should see such an interface.
-
To download press the download section.
-
If you want to closing the connection before the elapse time press
ctrl+cwhich will close the port and terminate the connection.
NOTE: If a directory contains html file and is clicked this renders the page on the browser,
index.htmlare also opened by default.
share over the internet
To share over the internet you need to tunnel your connection to a remote server also known as port forwarding
There are couple of methods, popular ones os using tools like ngrok, localxpose or cloudflared.
For simplicity I'll demonstrate using cloudflared since it doesn't require an account.
-
Download and install your operating system's cloudflared executable.
-
Run the
NAS-server.pyscript normally from one terminal and open a separate one and run.
cloudflared tunnel --url=http://localhost:8080Of course you have to use the url from the script if you did not specify the port.
- You can now share the provided link
https://...-trycloudflare.comto a friend and he can then connect and download the files you are sharing.
NOTE: The link is not consistent and you may be assigned a new link if you restart your cloudflared connection. Share this link with trusted individuals for security purposes.
-
ctrl+cto close the cloudflared connection, for advanced setup you can go through cloudflared documentation and create an account to get your own domain. -
For more info on the tool run
cloudflared --helpon your commandline or visit their github repo.
- Feel free to mod the
html, andcsstemplate in theWebdirectory, You can also embedjavascriptbut will have to go under script tag in the html.


