[PYTHON] One Liner Web Server

I want to start a web server simply and temporarily for the purpose of measuring download speed. However, I don't like the fact that files unrelated to production remain in lib and bin after installing apache. In such a case, you can start the web server with python (listen http). And with one liner!

Server side

  1. Become root

  2. Create a file in the current directory. This will be the file delivered via http

    # echo hoge > index.html
  3. Execute the following to put port 80 in the LISTEN state (start the web server)

    # python -m SimpleHTTPServer 80

Client side

  1. Get index.html with curl or wget

    $ wget http://Server host name/index.html
  2. Check the file

    $ cat index.html
    $ hoge

Reference URL


Recommended Posts

One Liner Web Server
One liner in Python
python Zundko One Liner
Web server construction commentary
Ubuntu (18.04.3) Web server construction
String shuffle one liner
One Liner Zundco Check
Merry Christmas web server
One liner to talk somewhere
curl -I python one liner
Linux Web server construction (Ubuntu & Apache)
Fastest and strongest web server architecture
CGI server (1) python edition in one line
Start the web server in the current directory
Port forwarding your web server using iptables
Web server for browser testing with Mocha
One liner webServer (with CGI) in python
Build a web server on your Chromebook
I wrote Project Euler 1 in one liner.
Publish the current directory on the web server