Configuring Apache For Ruby On Rails

Posted on 2007-10-06
Last Modified: 2012-06-27
I have an installation of LAMP through XAMPP; i.e. I have PHP, MySql, Apache configured.
I also downloaded Ruby and installed Rails through Ruby Gems command line.

What do I do next? How do I create a Rails app and how to configure Apache to render the same?
Question by:lexxwern
    1 Comment
    LVL 21

    Accepted Solution

    Step by step tutorial below...

    Apache needs to be configured for running CGI files in order for Rails to run. So make sure you have AddHandler cgi-script .cgi somewhere in your Apache config file.

       1. Set up Apache for the Rails application. If you plan to run your application at the DocumentRoot of a virtual host (perhaps as your entire web site), see Example for Apache conf below. If you would like it to live elsewhere see
       2. Go to rails/ (or whatever is your ServerName) and check that you get the Congratulations, youre on Rails! screen
       3. Follow the guidelines on the Congratulations, youre on Rails! screen

    Example for Apache conf

    In the Apache configuration given, replace the /path/application with the full path to the rails directory unpacked with the tar.gz, and be sure to append the public or log directory on where noted below. I also had to turn on CGI and set some access requirements as shown below. The AllowOverride line is important  internally, Rails uses some redirection that takes place in a .htaccess file located in the public folder. (Suse 9.1s Apache is locked down fairly tight.)

    Rails also requires the mod_rewrite module.

    LoadModule rewrite_module modules/
    LoadModule env_module modules/

    <VirtualHost *:80>
       SetEnv RAILS_ENV development
       ServerName rails
       DocumentRoot /path/application/public/
       ErrorLog /path/application/log/apache.log

       <Directory /path/application/public/>
          Options ExecCGI FollowSymLinks
          AddHandler cgi-script .cgi
          AllowOverride all
          Order allow,deny
          Allow from all

    Also, make sure that apache has write permissions to the /path/application/tmp directory.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    In Ruby, Call or invoke a API DLL library is easily via Win32API class, win32-api gem or other gems. For general DLL API call, there are quite a few references, some good tips list below:…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now