Running a Local Server Bookmark

In this tweet Andy Bell mentions that you can run a local Python server with these easy commands:

  1. Open your Terminal
  2. cd to your project directory
  3. Run python -m SimpleHTTPServer
  4. Open your browser to localhost:8000
  5. Done

I didn’t know about the Python way, but another possibility is to run a PHP server, which is a similar process:

  1. Open your Terminal
  2. cd to your project directory
  3. Run php -S localhost:9090
  4. Open your browser to localhost:9090
  5. Done

As Zell points out, you can also run a server as a Node module.

  1. npm install -g http-server (do this once)
  2. Open terminal and type http-server
  3. Go to localhost://8080

As with many things, the best way depends on what you are planning to do. What I like about the first two options, is that you can just run them and do't need to install anything to get going. The last option requires you to download an install the module (globally, hence only once), but still I prefer to not having to do this. Either way, enjoy running your local sites!

Leave a comment

Available formatting commands

Use Markdown commands or their HTML equivalents to add simple formatting to your comment:

Text markup
*italic*, **bold**, ~~strikethrough~~, `code` and <mark>marked text</mark>.
- Unordered item 1
- Unordered list item 2
1. Ordered list item 1
2. Ordered list item 2
> Quoted text
Code blocks
// A simple code block
// Some PHP code
[Link text](
Full URLs are automatically converted into links.

Replied on your own website? Send a Webmention!