When I reinstalled my system w/ Lion a few weeks back, I decided to start using Pow! as my “web server” of choice. I’ve been spending a lot more time in Rails over the past few months because of my day job and wasn’t really relying on my Apache/PHP installation as much. I
delegated Apache off to port 8080 while Pow took port 80 over because it was just too convenient.

The way I’ve always done my PHP development was just dump my projects in subdirectories of the Apache web root (/Library/WebServer/Documents) and leave it at that. Most of my URLs would look something like: http://localhost:8080/some-project.

Today I was luck enough to come across this post in Assaf Arkin’s Lab Notes site: Using Pow with your Node.js project. Long story short is that it uses the fact that config.ru is actually a Ruby script and uses it to make a little proxy to connect to whatever node.js server/daemon that you happen to be running. It still requires you to start it up, but it’s pretty convenient to have it with the same URL scheme and port 80-ness of the rest of your projects.

I immediately decided to see if I could modify it to:

  • Work on my port 8080 Apache install and
  • Get it to automatically work with my subdirectory scheme.

First, I dropped an .rvmrc into my PHP project’s directory so I had a php specific gemset.

Then, I installed rack into that gemset.

I copied in my modified config.ru (which, incidentally has the path some-project hardcoded at the moment — I’ll clean it up later.)

And lastly, symlinked my directory into my ~/.pow dir. Since I use powify, I just did a powify create to basically do the same thing.

Pointed my browser to http://some-project.dev and voila! I don’t see any visible slowdowns related to the proxy, and it works really nicely. It’s a keeper!

Ted Kulp

Ted Kulp is a professional developer, author and technologist with over 15 years of experience from the suburbs of Philadelphia. In 2004, he created the popular content management system, CMS Made Simple and continued to run the project for over 8 years. These days, he makes his living from writing Javascript full-time, writing books, and hacking on open source.

More Posts - Twitter - Facebook - LinkedIn - GitHub

Notice: mc4wp_form is deprecated since version Mailchimp for WordPress v3.0! Use mc4wp_show_form instead. in /var/www/html/wp-includes/functions.php on line 4440

Find this interesting?

Sign up for my newsletter for more interesting content.