Creating a Simple HTTP Server
suggest changeTo share files or host a simple static site on a trusted network, use Python's built-in http.server module. From the directory to serve, run:
python -m http.server 8000
If the port number is not given, 8000 is the default port. The startup line is:
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
By default, the server listens on all interfaces. To make a development server accessible only from the local machine, use python -m http.server 8000 --bind 127.0.0.1. Another machine uses this computer’s LAN address, which often looks like 192.168.x.x, not 0.0.0.0.
Stop the server with Ctrl+C. This server is intended for development and trusted local networks, not production use.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents