Skip to content

Deploying under passenger

lnthai2002 edited this page Jun 18, 2013 · 3 revisions

As of version 0.8.0, RubyCAS-Server can be deployed under Apache or nginx using the Phusion Passenger module (also known as mod_rails/mod_rack). This is now the preferred method for deploying RubyCAS-Server in a production environment.

No additional configuration is required to run RubyCAS-Server under Passenger. Just follow the normal instructions for a Passenger app (see http://www.modrails.com/).

Follow the Quick Start instructions to get a basic RubyCAS-Server instance running.

Note that the server setting in your config file (and related settings) are ignored when running under Apache, since the port, location of the SSL certificate, etc. are all configured in your Apache vhost.conf.

Apache

Set up a virtual host entry in Apache for RubyCAS-Server (as shown in the example below). Assuming that you have Passenger installed properly, after restarting Apache you should find that your CAS server is up and running at https://localhost (or whatever ServerName you set in your vhost configuration).

By default the CAS server log is under /var/log/casserver.log, but you can change this location in your config.yml file. If you run into problems, first consult your Apache error_log file and then the casserver.log.

Example Apache vhost config
Listen 443
<VirtualHost *:443>
  ServerAdmin admin@example.net
  ServerName login.example.net

  SSLEngine On
  SSLCertificateFile /etc/apache2/ssl.crt/example.pem

  RailsAutoDetect off  #Take this off if you use passenger > 4.0.0

  DocumentRoot /srv/www/rubycas-server/public

  <Directory "/srv/www/rubycas-server/public">
    AllowOverride all
    Allow from all
  </Directory>
</VirtualHost>

nginx

Example nginx config
server {
  listen 443;
  server_name login.dev.com;
  ssl on;
  ssl_certificate /etc/ssl/certs/my.crt;
  ssl_certificate_key /etc/ssl/private/server.key; root /srv/www/rubycas-server/public;
  passenger_enabled on;
}