Running and sharing your local web servers
If you are a web developer or a web designer, you will have run a local web server as part of your design or development process. Two of the most common ways to do this on OS X are with MAMP or the bundled Apache installation. One of the problems with this approach is that you are restricted to where your work files are located (or else you have to start editing configuration files). There is a simple solution (if your machine has Python installed). I have a project in
/Users/john/handy that has two files, index.html and about.html (well it is a handy project). I want to test these files in a web server, so I run the following command in the terminal:
$ cd /Users/john/handy $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...
I can now visit
http://localhost:8000/ and index.html will be served. The about page can be viewed by going to
http://localhost:8000/about.html. Of course the
SimpleHTTPServer is functionally limited, and it’s only useful for serving static files, but in the early stages of a project this is all you need sometimes.
How do I share my work with another party? Say Gearóid wants to see what I’ve done, and wants to play around with the site himself. The simplest way I’ve found is showoff.io. Here’s the skinny:
$ gem install showoff-io $ show 8000 Do you have a Showoff account? [y/N] Connected using 5 minute trial. Share this URL: https://xyz.showoff.io/
I send Gearóid the link
https://xyz.showoff.io/ and he can then play with my
handy web site. It’s that simple!
As you can see in the output above, showoff.io, have 5 minutes trials. When that time period is up,
https://xyz.showoff.io/ will no longer serve my files. You can buy $1 tokens, that keeps the URL alive for 24 hours, or you can buy a $5 per month subscription for unlimited access.