Basic merb deployment using Apache mod_proxy
For working configuration you will need:
- Apache 2.2 with mod_proxy and mod_proxy_http
- write access to httpd.conf (as well as rights to restart apache server)
- merb application
Go to merb app root dir, start app. By default it will listen on port 4000.
To make it listen on another port, use:
merb -p port_number
Now open httpd.conf, and place this code after modules loading:
<Proxy balancer://host_name>
BalancerMember http://127.0.0.1:port_name
</Proxy>
Next, in your virtual hosts file, add 2 lines to your host configuration:
ProxyPass / balancer://host_name/
ProxyPassReverse / balancer://host_name/
Your host configuration may look like this:
<VirtualHost *:80>
ServerAdmin admin@host_name
DocumentRoot /path/to/your/host_name
ServerName host_name
ErrorLog /path/to/your/error.log
ProxyPass / balancer://host_name/
ProxyPassReverse / balancer://host_name/
</VirtualHost>
After apache restarting, you should see your app in browser at the address http://host_name
Comments
On May 22, 2008 at 05:02 jnicklas says:
I’m no Apache whizz, but wouldn’t this make merb serve static files? That¨s probably not desirable, and should be relatively easy to fix. For a cluster, you could do:
Also if you are running merb on only a single port, you really don’t need the proxy balancer. Just use a normal proxy pass, not sure if these rewrite rules are correct:
On May 22, 2008 at 05:05 jnicklas says:
Ohh, that got nicely mangled, what formatting is used here? Anyway, here’s a pastie:
http://pastie.caboo.se/201469
On August 23, 2008 at 09:10 taerb says:
This is exaclty what I needed and worked great for me.
Sign in to make your voice heard