Archiv der Kategorie: Ruby

Setup Ruby On Rails with RVM, Phusion Passenger on Plesk

It can be quite frustrating to setup Ruby On Rails in a Plesk-Environment, if you don’t want to use the build-in Ruby or Phusion Application. I deploy my RoR-Apps with mina deploy and use RVM for different Gemsets und Ruby-Versions. Of cource, you can use the Application build in Plesk (rbenv, Ruby in a specific version), but sometimes it’s not suitable.

Let’s assume, that the source code is in the directory /home/rails/my_app/. Deployed by mina, git or something else.

Apache Settings in Plesk

You can specify Apache directives in the Apache & nginx Settings of your domain or subdomain:

Apache directives for HTTP and HTTPS

In my case, my application is accessable only over HTTPS, so I use these configurations:

# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /home/rails/my_app/public
PassengerRuby /usr/share/rvm/gems/ruby-2.3.3@app_gemset/wrappers/ruby

# Relax Apache security settings
<Directory /home/rails/my_app/public>
  Allow from all
  Options -MultiViews
  # Uncomment this if you're on Apache > 2.4:
  #Require all granted

My apps are located in the home directory of the user “rails”.  The ruby directory is the standard RVM location for the gemset “app_gemset”.

If the Ruby On Rails Application is configured correct (database.yml, file permissions etc.) you should see the HTML, if you open the domain or subdomain in a browser – but without the assets (images, CSS, JS etc.).

Outsmart static files processing

You have to unselect the following point on the Apache & nginx Settings Page:

After this small change, the Ruby On Rails application should be shown correct in your browser.