cancel
Showing results for 
Search instead for 
Did you mean: 
ricardodacosta
Moderator
Moderator
  • 2,080 Views

Need a quick web server to serve content from the current directory?

You may have a an occassional need to setup a transient webserver (without installing any additional packages). 

This is really easy with Python.

Simply change to the directory from which you want to serve content, and run the following:

python -m SimpleHTTPServer 80

Be mindful that only privileged users can bind to privileged ports.

Labels (2)
2 Replies
  • 2,066 Views

There's also

python3 -m http.server [port]

In case you prefer python 3 or want to avoid the shift key. 

ricardodacosta
Moderator
Moderator
  • 2,064 Views

Thanks @KevinMGranger!

Just to remind our users that the above will work with python3 installed, RHEL7 still ships with python2.

0 Kudos
Join the discussion
You must log in to join this conversation.