Rails
Rails or Ruby on Rails is a web application framework.
Installation
Install dev-ruby/rails:
root #emerge --ask dev-ruby/railsSetup
root /var/www #rails new ror
root /var/www #cd ror
root /var/www/ror #rails server
Point a web browser to http://0.0.0.0:3000. are now riding rails via WEBrick. This is only for testing, not production. WEBrick could probably be used for production if it were behind nginx or an accelerator proxy such as varnish.
Configuration
Rails is not eselect aware, this might come in handy to resolving some issues, but be aware that bundle install will blast things away.
root #eselect rails listroot #eselect rails set 1Passenger via apache
Emerge passenger:
root #emerge --ask www-apache/passengerAdd -D PASSENGER to the APACHE2_OPTS variable in Apache's config:
/etc/conf.d/apache2add -D PASSENGER to apache's configAPACHE2_OPTS="-D PASSENGER"
Passenger needs Apache to relax the rules a little bit. Edit the /etc/apache2/modules.d/30_mod_passenger.conf file and insert relaxed settings before the closing </IfDefine> tag:
/etc/apache2/modules.d/30_mod_passenger.confapache 2.2<syntaxhighlight lang="apache"><Directory /> Options FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> </IfDefine></syntaxhighlight>
/etc/apache2/modules.d/30_mod_passenger.confapache 2.4<syntaxhighlight lang="apache"><Directory /> Options FollowSymLinks AllowOverride all Require all granted </Directory> </IfDefine></syntaxhighlight>
Backup the original Apache vhost:
root #mv /etc/apache2/vhosts.d/00_default_vhost.conf /etc/apache2/vhosts.d/00_default_vhost.conf.backupDrop in the passenger vhost file for Apache:
/etc/apache2/vhosts.d/00_default_vhost.conf<syntaxhighlight lang="apache"><IfDefine DEFAULT_VHOST>
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/ror/public
# RailsBaseURI /
RailsEnv development
<Directory /var/www/ror/public>
Options -MultiViews
</Directory>
</VirtualHost>
</IfDefine></syntaxhighlight>
root #/etc/init.d/apache2 restartPoint a web browser to http://0.0.0.0 or http://127.0.0.1 or http://localhost and your riding rails via passenger now.
See also
- Ruby - The programming language used to build Rails.