Skip to content

Instantly share code, notes, and snippets.

@filipebarcos
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipebarcos/5498da90a920ab33242b to your computer and use it in GitHub Desktop.
Save filipebarcos/5498da90a920ab33242b to your computer and use it in GitHub Desktop.
Quick-simple script to upgrade ruby version on a server using RVM and Phusion Passenger.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-2.1.1/gems/passenger-4.0.57/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/ubuntu/.rvm/gems/ruby-2.1.1/gems/passenger-4.0.57
PassengerDefaultRuby /home/ubuntu/.rvm/gems/ruby-2.1.1/wrappers/ruby
</IfModule>
After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a web application: an example
Suppose you have a web application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /home/ubuntu/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.57/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/ubuntu/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.57
PassengerDefaultRuby /home/ubuntu/.rvm/gems/ruby-2.1.5/wrappers/ruby
</IfModule>
After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a web application: an example
Suppose you have a web application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
#!/bin/bash
set -e
# This script expects a string on same version format from RVM (i.e. ruby-2.1.5)
rvm install $1
rvm $1 do gem install bundler passenger
rvm $1 do yes '' | passenger-install-apache2-module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment