Share Files Using Lightweight Http Servers in Linux

Home

Table of Contents

https://linuxhint.com/share_files_lightweight_http_server/

1 Share Files Using Lightweight Http Servers in Linux

Lightweight server applications in Linux can be used to quickly share files between two or more devices. These web server applications are not suitable for advanced web applications that require tighter security, authentication and performance. However, they are perfectly fine if you want to use them to temporarily share files locally or remotely between multiple devices. This article will list some of these static HTTP server applications. So let’s jump in.
SimpleHTTPServer
Simple HTTP server is a built-in python module that can be used to launch a lightweight server suitable for running basic web applications and lightweight file server. As it is a built-in module, it comes pre-installed on almost all Linux distributions having Python installed by default.

Simple HTTP server serves all the files located in the folder it is run from. Run the following commands in succession to launch a simple HTTP server in the “Downloads” folder located in your home directory (commands below are for Python 3 only).

$ cd $HOME/Downloads
$ python3 -m http.server

To run the server on a different port, run the following command instead (change port number according to your requirements):

$ python3 -m http.server 8080

You will see following terminal output on successful launch of the server:

Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
If you click on the URL mentioned in the terminal output shown above, you will be able to see a basic file browser layout in the web browser (also on http://localhost:8000/):

Author: Sebastian Emilio Narvaez

Created: 2020-06-13 Sat 12:20

Emacs 25.2.2 (Org mode 8.2.10)

Validate