Skip to content

Instantly share code, notes, and snippets.

@vicentereig
Created August 10, 2012 10:20
Show Gist options
  • Save vicentereig/3313207 to your computer and use it in GitHub Desktop.
Save vicentereig/3313207 to your computer and use it in GitHub Desktop.
Apache 2 + Proxy Balancer + Thin + Rails Asset Pipeline Development Environment for MacOSX
# These modules should be loaded by default: proxy_module, proxy_balancer_module, rewrite_module
Listen *:80
# You may want to keep the VirtualHost config under extra/*.conf
# Start your thin
<VirtualHost *:80>
ServerName wwww.yourawesomeapp.dev
DocumentRoot /Users/vicente/Workspaces/yourawesomeapp/public
RewriteEngine On
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000
BalancerMember http://127.0.0.1:5001
BalancerMember http://127.0.0.1:5002
</Proxy>
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]
ProxyPass / balancer://thinservers/
ProxyPassReverse / balancer://thinservers/
ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Directory /Users/vicente/Workspaces/yourawesomeapp/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
@vicentereig
Copy link
Author

Use something clever like https://github.com/ddollar/foreman/ to start your thin workers.

@Wolfsrudel
Copy link

The RewriteRule will never match, because the ProxyPass afterwards will redirect everything. O.o

@vicentereig
Copy link
Author

Took me a while to get to this gist again. I'll give it a shot again shortly as I'm not using this setup since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment