Skip to content
This repository was archived by the owner on May 15, 2020. It is now read-only.

Running Pow with Apache

kimptoc edited this page Jul 11, 2011 · 24 revisions

If you want to run pow alongside the MacOS X built-in apache this page will instruct you on how to setup pow so that it doesn't takeover port 80 and instead apache will reverse proxy requests to pow.

For the Impatient

$ curl get.pow.cx/uninstall.sh | sh #if you have pow installed
$ echo 'export POW_DST_PORT=88' >> ~/.powconfig
$ curl get.pow.cx | sh
$ sudo curl https://raw.github.com/gist/1058580/zzz_pow.conf -o /etc/apache2/other/zzz_pow.conf
$ sudo apachectl restart

Full Installation Instructions

1. Before installing

Before you install pow, add the following line to your ~/.powconfig

export POW_DST_PORT=88

Here it is as a one-liner

$ echo 'export POW_DST_PORT=88' >> ~/.powconfig

This will cause pow's firewall run to redirect all traffic from port 88 instead of port 80. You can pick any port you like for this if you use 88 for something else. It doesn't effect the remainder of these instructions. If you have already installed pow, you will need to uninstall it before you you continue.

2. Install pow as normal

If you need those instructions, you can find them here: Installation

3. Configure Apache

You'll need to drop the file in this gist into

/etc/apache2/other/zzz_pow.conf

Here it is as a one-liner

$ sudo curl https://raw.github.com/gist/1058580/zzz_pow.conf -o /etc/apache2/other/zzz_pow.conf

This sets up apache to act as a reverse proxy to pow. It goes directly at pow's default listen port, not the firewall port we configured in the previous step. The file name zzz_pow.conf to ensure that apache picks up the vhost for pow last, allowing you to put vhosts for other apps in front of it.

4. Start/Restart Apache

You'll need to turn on "Websharing Sharing" in the MacOS X system preferences if you haven't already. You can find it in System Preferences -> Sharing -> Web Sharing. NOTE: This will make it so anyone with your machines IP Address can access your apache server. This is the default setting from apple. If you want to change this, you will want to change the IP address that apache binds to in /etc/apache2/httpd.conf.

If Apache is already running, you can restart by either turning Web Sharing off and then back on, or you use this on the command line

$ sudo apachectl restart

After Installation

Leveraging pow's DNS for other apps

If you now configure your vhosts for the apps you want to run in apache with *.dev hostnames, pow will provide the DNS resolution for you, which means you get to keep the benefit of not mucking with your hosts file. For example, if you have a php app, you can setup it's vhost entry to use

Using ssl with pow

This setup can be extended to allow using ssl with pow. You simply need to configure the pow vhost we setup for apache for ssl by following he apache documentation. The implementation is left as and exercise for the reader, and is ruled by the normal limitations of using ssl with apache and a name-based vhost configuration.

Troubleshooting

Apache is servicing a request that I expect to be passed to pow

Make sure that you don't have another virtual host that is configured with the same name

Pow is servicing a request that I expect to be passed to Apache

Make sure that you have another (default) virtual host configured. For example, something like this:

/etc/apache2/other/aaa_default.conf

<VirtualHost *:80>
  #no need for settings, use apache defaults.
</VirtualHost>

Clone this wiki locally