Skip to content

Instantly share code, notes, and snippets.

@bunnymatic
Created June 21, 2011 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bunnymatic/1037191 to your computer and use it in GitHub Desktop.
Save bunnymatic/1037191 to your computer and use it in GitHub Desktop.
Apache mods to point to a thin server
<VirtualHost *:80>
ServerName sinatra.yourserver.com
ServerAlias sinatra.yourserver.com
DocumentRoot /home/your_app_user/webapp/current
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>
# Redirect all non-static requests to thin
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>
# Custom log file locations
ErrorLog /usr/local/apache/logs/sinatra_error.log
CustomLog /usr/local/apache/logs/sinatra_access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment