Set this alias in your .zshrc and never need anything to serve your files.
This is a super handy trick. Not only does it saves a lot of time wasted to install and configure apache, also you don't need to move/copy your files to the public_html directory.
First setup this alias in your mac/linux boxes: Either Zsh or Bash will do:
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
python -m SimpleHTTPServer "$port"
}
Then, whenever you need to serve a directory just cd and type server
Eg:
$ cd Website/
$ server
That's it. I think it is a must for web developers, you just want a local server without much fuss.
P.S You must have Python installed.
Written by Vinit Kumar
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Web
Authors
johnbender
77.79K
hector
56.26K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#