Does scripts.mit.edu support Ruby on Rails?
Yes. Here is the procedure for getting Ruby on Rails working on scripts.mit.edu:
1. Make sure you have created a scripts account, and then ssh to scripts.mit.edu.
2. Create a new directory for your Ruby on Rails application and cd into it.
3. Run rails . to create your Rails application. (Note: We strongly recommend that you create and develop your site on scripts.mit.edu as opposed to creating it somewhere else and moving it to scripts.)
4. Run chmod 777 public/.htaccess (if you want to know why, read this page).
5. At the bottom of the public/.htaccess file under your Rails application, add the following text:
RewriteBase /~USERNAME/PATH_TO_APP/public/
(with USERNAME replaced by your username and PATH_TO_APP replaced by the path under your web_scripts directory to your Rails application. For example, if I created the directory /mit/jbarnold/web_scripts/myrails for my Rails application, I would use RewriteBase /~jbarnold/myrails/public/.)
6. Create a .htaccess file in your application’s main directory (not in the public directory; instead, one level above the public directory)
7. Run chmod 777 .htaccess on this htaccess file.
8. Put the following text in the .htaccess file:
RewriteEngine On RewriteRule ^(.*)$ public/$1 [QSA,L] RewriteBase /~USERNAME/PATH_TO_APP/
(with USERNAME replaced by your username and PATH_TO_APP replaced by the path under your web_scripts directory to your Rails application).
9. Add the following text near the top of config/environment.rb:
ENV['RAILS_RELATIVE_URL_ROOT'] = "/~USERNAME/PATH_TO_APP"
(with USERNAME replaced by your username and PATH_TO_APP replaced by the path under your web_scripts directory to your Rails application; note that PATH_TO_APP should not end in a slash (/).)
10. If you want to use a database on sql.mit.edu, edit config/database.yml. (Remember to explicitly set the host to sql.mit.edu)
11. Once you’ve finished developing your website and aren’t planning to make a lot of changes, you should consider turning on FastCGI. This will make the site load much faster, but changes to the code will not be reflected immediately in the site. To turn on FastCGI, find the line in public/.htaccess that says
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
and change it to say
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

| Previous: | Why isn't my symlink working? |
| Next: | How do I redirect visitors to my web.mit.edu or www.mit.edu URL to my scripts.mit.edu website? |
These pages may be reused under either the GFDL 1.2 or CC-BY-SA 3.0.
Questions? Contact scripts@mit.edu.
You are currently connected to bees-knees.mit.edu.
