Pow, Apache, Rails, WordPress, and Yosemite
Tags: hosting • Categories: Web Development
Table of Contents
I work on both PHP (WordPress) and Rails sites. It’s important that it is easy to switch contexts and manage all of the different environments. I’m constantly tweaking my dotfiles to make things easier.
I recently updated to Yosemite and ran into some issues getting Apache and Pow to play nicely along with each other. Here were my goals:
- Run rails apps through Pow. I want to be able to visit http://myapp.dev/ and spin up my rails app
- Visit WordPress sites on *.dev domains. I want http://wordpresssite.dev/ to render out my WordPress sites
- PHP sites need to run on Apache for development/production parity
- I don’t want to manually edit Apache configuration files each time I add a new site
Here’s the solution that worked for me:
- Install Pow. (I use powder)
- Set POW_DST_PORT in ~/.powconfig
- Manage pow rails app linking via `powder link` (for convenience)
- Put all WordPress sites in ~/Sites/thedomain.com
- Customize your Apache configuration:
- Remove the default php Apache configuration in /etc/apache2/other
- Add explicit “Require all granted” to avoid forbidden access errors with Apache 2.4
- Redirect all requests to http://thesite.wp.dev/ to ~/Sites/thesite.com
- Reverse proxy all of the remaining *.dev request to Pow