Saturday, April 15, 2023

One-liner: Python webserver to display files

Go into linux directory that has the files you want to serve.

Start the webserver in the directory of the files you want to expose:

$ python3 -m http.server 8321


Test it from another machine by using a web browser and going to the hostname:port:

http://some-host-name.duckdns.org:8321


To persist the webserver after you log out of the shell, use nohup:

$ nohup python3 -m http.server 8321 &


No comments:

Post a Comment