Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to deploy a Ruby on Rails Application using Passenger and Apache but I have some trouble. When I try to go to example.com/tournament, I get an error saying that the Ruby on Rails application couldn't be started along with the following error:

No such file or directory - config/environment.rb

After doing some searching, there seems to be something wrong with my virtual host configuration since all permissions are correct. Can you find whats wrong with this configuration? Note that example.com is not what is in my configuration, I have a different domain there.

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /srv/www/example.com/public_html
    ErrorLog /srv/www/example.com/logs/error.log
    CustomLog /srv/www/example.com/logs/access.log combined

    RailsBaseURI /tournament
    <Directory /srv/www/example.com/public_html/tournament>
            Options -MultiViews
    </Directory>
</VirtualHost>
share|improve this question

1 Answer 1

Looks like your DocumentRoot declaration needs to also point to the root of your Rails app.

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com

    DocumentRoot /srv/www/example.com/public_html/tournament

    ErrorLog /srv/www/example.com/logs/error.log
    CustomLog /srv/www/example.com/logs/access.log combined

    RailsBaseURI /tournament
    <Directory /srv/www/example.com/public_html/tournament>
            Options -MultiViews
    </Directory>
</VirtualHost>

Setting DocumentRoot tells Passenger where to start from when it does its check for your Rails environment.rb file. Take a look here for more info.

Let me know if that helps!

Edit: corrected a goof in the DocumentRoot path.

share|improve this answer
    
How would I then go about for having an application based in PHP and one based in Rails on the same domain? –  Jawesome Jul 27 '11 at 17:22
    
I think you can achieve that by having a separate VirtualHost declaration pointed at port 80 with that separate information (pointed at a DocumentRoot of your …public_html/ directory). I could be wrong, if somebody wants to correct me. –  Ben Kreeger Jul 27 '11 at 17:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.