0

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>

1 Answer 1

0

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.

2
  • How would I then go about for having an application based in PHP and one based in Rails on the same domain? Jul 27, 2011 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. Jul 27, 2011 at 17:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .