Serving instances on port 80 already used by apache - Ramaze/ramaze GitHub Wiki
If apache already serves this port and you don't want to use Passenger, you're not stuck.
Apache comes with two nifty modules : mod_proxy and mod_proxy_balancer. So you can set-up apache as a front-end to your thin/unicorn workers. The configuration is quite straightforward. Create a VirtualHost (if needed), and add the following directives in your VirtualHost config filei :
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>
If you need a fallback server that responds only when other servers
are dead, you can add a member in the <Proxy>
directive with the
status=+H
option :
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000
BalancerMember http://127.0.0.1:5001
BalancerMember http://127.0.0.1:5002
BalancerMember http://someserver.example.com:80 status=+H
</Proxy>