Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to serve files using HTTP server

📅 2018-Sep-18 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ python ⬩ 📚 Archive

Files can be shared over a home or local network using SMB or Windows sharing or SSH-based techniques (like SSHFS). But sometimes it is easiest to run a simple HTTP server on the source computer and browse the files in any web browser on client computers on the network. To do this we need to run a HTTP server on the source computer.

Python HTTP Server

The simplest HTTP server that allows file browsing is the one that is built into Python called http.server.

$ python3 -m http.server

This serves on port 8000 and you can access the content in any browser on the home network at http://<ip-address-of-server>:8000/.

$ python3 -m http.server 10000
$ python3 -m http.server --directory /path/to/dir
$ python -m SimpleHTTPServer

Tried with: Ubuntu 22.04

© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email