Skip to content

Instantly share code, notes, and snippets.

@dinks
Created November 27, 2013 13:22
Show Gist options
  • Select an option

  • Save dinks/7675570 to your computer and use it in GitHub Desktop.

Select an option

Save dinks/7675570 to your computer and use it in GitHub Desktop.
Apache+Unicorn
<VirtualHost *:80>
ServerName xxx
ServerAlias xxx
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:5000
</Proxy>
RewriteEngine On
# Static files are served by Apache rest by Unicorn
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
# NOTE Uncomment if you want Unicorn to serve static content
# ProxyPass / balancer://unicornservers/
# ProxyPassReverse / balancer://unicornservers/
# ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment