SSL with Mongrels and Apache
Using the certificates from Basic SSL for use with Web and Mail
4) Configure a new apache virtual host to proxy balance to these mongrels, using port 443.
# cd /opt/csw/apache2/etc/virtualhost # nano myrailsapp-domain-ssl.conf
With the contents of:
<VirtualHost YOUR-PUBLIC-IP:443>
ServerName YOURDOMAIN.com
DocumentRoot /home/YOUR/PATH/TO/RAILS/APP/public
<Directory "/home/YOUR/PATH/TO/RAILS/APP/public/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://app1-mongrels%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://app1-mongrels>
BalancerMember http://YOUR-PRIVATE-IP:8000
BalancerMember http://YOUR-PRIVATE-IP:8001
BalancerMember http://YOUR-PRIVATE-IP:8002
BalancerMember http://YOUR-PRIVATE-IP:8003
</Proxy>
ProxyPass /images !
ProxyPass /stylesheets !
ProxyPass / balancer://app1-mongrels/
ProxyPassReverse / balancer://app1-mongrels/
ProxyPreserveHost On
RequestHeader set X_FORWARDED_PROTO "https"
SSLEngine on
SSLCertificateFile /home/ssl/part.domain.com.crt
SSLCertificateKeyFile /home/ssl/part.domain.com.key
</VirtualHost>