Run simple HTTP server on localhost

Sometimes you need to quickly run a simple HTTP server on your localhost to test or try something. If you already have Python installed, then you don’t need to go through installing a separate web service like Apache HTTPD or NGINX. Instead, cd to the directory where your .html files are located, then run the following command:

$ python -m SimpleHTTPServer 80
Serving HTTP on port 80 ... - - [25/Mar/2020 15:03:44] "GET / HTTP/1.1" 200 -

If you had the following file index.html:

    <title>Test Page</title>
    <div>My test page</div>

It would look like this:

Leave a Reply

Your email address will not be published.