My previous post elaborated on how to prevent having to update both your local Apache vhosts and the /etc/hosts file for each new project. Due to a jobchange, I'm working mainly with Rails projects nowadays, as well as a few PHP projects.
Rails / POW
To host my Rails/Sinatra projects I'm using POW, the lightweight Rack-server for Mac. It circumvents /etc/hosts and re-routes everything coming in on port 80 to *.dev. All I need to do to load a new Rails app is to create a symlink from the project to the ~/.pow folder once, and I'm good to go.
PHP / Apache
My PHP projects are still hosted by Apache with mainly the same setup explained in my previous post, but with an added bonus: Because POW has its own DNS server built in, I can now access the following:
http://php-project.company.dev instead of http://php-project.company.127.0.0.1.xip.io
Previously, the xip.io lookup required me to be online at all times. Now I can happily go offline to continue my work. All that was needed to accomplish this, was to let Apache listen on port 8080 (or a port of choice) instead of port 80, which is now used by POW. You can view the change I made in my httpd.conf on github.
On a sidenote; I first tried it the other way around. I wanted POW to re-route to port 81 instead of port 80 by creating a ~/.powconfig file containing export POW_DST_PORT=81, which didn't work for me. My guess is port 80 was somehow still occupied by POW.
What about xip.io?
It still works like you'd expect it to work. If I need to test an app on mobile devices, I look up my network IP:
This will result in the following URL: http://rails-project.192.168.0.105.xip.io
By replacing the localhost reference with the IP above, I'm able to access my local website on multiple devices as long as they're connected to the same network.