mongrel cluster on a vps with cpanel
- Resrev
- Posts: 3
- Starts: 3
- Wiki Edits: 0
Hey, I just set up a new vps with cPanel and am setting up my rails app using a mongrel cluster. cPanel keeps overwriting the proxy balancer settings in my httpd.conf file. I recently had a shared account with cPanel and mongrel cluster, so I know the configuration is possible. Anyone have a configuration solution?
- Varun
- Posts: 410
- Starts: 0
- Wiki Edits: 0
Resrev -
To add a mongrel/mongrel cluster proxy to your Apache configuration, just follow the instructions below.
==============
* mkdir /usr/local/apache/conf/userdata/std/2/username/domainname.com
(You may need to create directories up to that spot if they haven't been created before)
* vi /usr/local/apache/conf/userdata/std/2/username/domainname.com/custom.conf
Put this in there and save it:
RewriteEngine On
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:4***
BalancerMember http://127.0.0.1:4***
#More can be added in this fashion
</Proxy>
* Then issue a:
/scripts/ensure_vhost_includes --user=username
* restart apache and make sure both apache and the client's domain are working correctly.
================
Replace "username" with your user name and "domainname.com" with your domain name.
cPanel 11 update scripts seem to wipe out custom entries like rewrite rules added in main httpd.conf file. But if you still wish to have them configured there, you need to run the script below and restart Apache.
/usr/local/cpanel/bin/apache_conf_distiller --update
This will save the custom configuration entries permanently saved into httpd.conf.
To add a mongrel/mongrel cluster proxy to your Apache configuration, just follow the instructions below.
==============
* mkdir /usr/local/apache/conf/userdata/std/2/username/domainname.com
(You may need to create directories up to that spot if they haven't been created before)
* vi /usr/local/apache/conf/userdata/std/2/username/domainname.com/custom.conf
Put this in there and save it:
RewriteEngine On
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://mongrel_cluster>
BalancerMember http://127.0.0.1:4***
BalancerMember http://127.0.0.1:4***
#More can be added in this fashion
</Proxy>
* Then issue a:
/scripts/ensure_vhost_includes --user=username
* restart apache and make sure both apache and the client's domain are working correctly.
================
Replace "username" with your user name and "domainname.com" with your domain name.
cPanel 11 update scripts seem to wipe out custom entries like rewrite rules added in main httpd.conf file. But if you still wish to have them configured there, you need to run the script below and restart Apache.
/usr/local/cpanel/bin/apache_conf_distiller --update
This will save the custom configuration entries permanently saved into httpd.conf.