One Line Web Server

Start a Web Server With One Terminal Command on OS X | CSS-Tricks

I’ve searched for this three times this week, so I figured I’d better make sure I have a copy of it. Python 2: python -m SimpleHTTPServer 8000 Navigate to the project directory in the terminal and do that command. Then http://localhost:8000 will server up that directory (as in, it’s `index.html` file).

  • Python2: python -m SimpleHTTPServer 8000
  • Python3: python3 -m http.server --cgi 8080
  • Php: php -S localhost:2222
  • Npm: npm i -g serve // serve