-
-
Save danott/1001253 to your computer and use it in GitHub Desktop.
Run this file to instal 37signals' Pow but use an Apache proxy instead of the firewall rule.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl get.pow.cx/install.sh | sh | |
# We don't actually want the firewall rule that pow installs | |
echo "Get rid of those silly firewall rules for port 80." | |
ports=($(ruby -e'puts $<.read.scan(/fwd .*?,([\d]+).*?dst-port ([\d]+)/)' "/Library/LaunchDaemons/cx.pow.firewall.plist")) | |
HTTP_PORT=${ports[0]} | |
DST_PORT=${ports[1]} | |
RULE=$(sudo ipfw show | (grep ",$HTTP_PORT .* dst-port $DST_PORT in" || true) | cut -f 1 -d " ") | |
[[ -n "$RULE" ]] && sudo ipfw del "$RULE" | |
# Unload the firewall plist and remove it. | |
sudo launchctl unload "$FIREWALL_PLIST_PATH" 2>/dev/null || true | |
sudo rm -f "$FIREWALL_PLIST_PATH" | |
# set up the Apache Proxy | |
echo "Configure the Apache proxy." | |
cat <<EOT > /tmp/pow_proxy.conf | |
<VirtualHost *:80> | |
ProxyPass / balancer://pow | |
ProxyPreserveHost On | |
<Proxy balancer://mongrel_cluster> | |
BalancerMember http://127.0.0.1:20559 | |
</Proxy> | |
RewriteEngine On | |
# Redirect all non-static requests to cluster | |
#RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] | |
</VirtualHost> | |
EOT | |
sudo mv /tmp/pow_proxy.conf /private/etc/apache2/other/pow_proxy.conf | |
sudo chmod 644 /private/etc/apache2/other/pow_proxy.conf | |
echo "\n\n" | |
echo "################################################################################" | |
echo "Now just (re)start Web Sharing in OSX's Sharing Preferences and" | |
echo "symlink your application into ~/.pow as per the pow directions." | |
echo "See http://pow.cx for more information." | |
echo "Protip: You may need to restart your computer for the resolver to work." | |
echo "It's an issue with Pow itself, not my fault. :-)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment