How to Use Python ‘SimpleHTTPServer’ to Create Webserver or Serve Files Instantly

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Thilina Uvindasiri

I'm a BSc Special (Hons) graduate in Information Technology and works as an Engineer-Systems. Love to work, explore and research Linux and play rugby as a hobby.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

15 Responses

  1. aerin says:

    Hi Thilina, thanks for the awesome post! I ran this as instructed (nohup python -m SimpleHTTPServer 80 &) however after 1-2 days, the server stops. Then I have to ps ax and kill SimpleHTTPServer manually and run again. Can you give me some advice- where to look at, why it stops after some time?

    • Thilina Uvindasiri says:

      Hi aerin,

      I think this can be happen due to a shell change. Cannot tell the exact reason without looking at it. But can you try using absolute path for the “nohup” command.
      Step 01. Enter “which nohup” in your logging shell.
      Below is the sample output.

      [root@tecminttest ~]# which nohup
      /usr/bin/nohup

      Step 02. Enter your command with absolute path for the “nohup” command.
      Eg:
      [root@tecminttest ~]# /usr/bin/nohup python -m SimpleHTTPServer 80 &

      Try this and let me know if the error still exists.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?