Bussiere
Bussiere

Reputation: 1152

Not a valid directory (didn't found the answer on the net)

Here is my question i have made a standard rail and redmine installation under ubuntu 12. And i have this error : The directory "/var/www" does not appear to be a valid Ruby on Rails application root.

It seems to be a common error but no solution on the net : http://www.google.fr/search?q=The+directory+%22%2Fvar%2Fwww%22+does+not+appear+to+be+a+valid+Ruby+on+Rails+application+root.+&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a

Here is my default file :

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www


<Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined


    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

PassengerDefaultUser www-data
RailsEnv production
RailsBaseURI /redmine
<Directory /var/www/redmine/>

AllowOverride None
AddHandler fcgid-script .fcgi
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

PassengerEnabled on
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>


</VirtualHost>
Include /etc/apache2/mods-available/passenger.conf

and my passenger.conf :

<IfModule mod_passenger.c>
  PassengerRoot /usr
  PassengerRuby /usr/bin/ruby
  PassengerDefaultUser www-data
</IfModule>

And i don't understand why ... Regards Bussiere

Upvotes: 1

Views: 2608

Answers (3)

aramisz
aramisz

Reputation: 11

Some installation instruction had a mistake with simlink creating. The right simlink is the following for using.

sudo ln -s /usr/share/redmine /var/www/redmine

vhost should be like this:

<VirtualHost *:80>
  ServerName redmine.yourdomain.tld  

  DocumentRoot /var/www/redmine/public  

  PassengerMaxPoolSize 4
  PassengerDefaultUser www-data
  RailsEnv production
  RailsBaseURI /  

  <Directory /var/www/redmine/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>  

  LogLevel info
  ErrorLog /var/log/apache2/redmine-error.log
  CustomLog /var/log/apache2/redmine-access.log combined
</VirtualHost>

Upvotes: 1

Silvio Relli
Silvio Relli

Reputation: 399

You should point DocumentRoot tho the public dir inside the rails app

DocumentRoot /var/www/YOUR_APP_NAME/public

[...]

<Directory /var/www/YOUR_APP_NAME/public>

Upvotes: 5

Buck Doyle
Buck Doyle

Reputation: 6397

DocumentRoot for a Rails application under Passenger should be the application’s public directory.

Upvotes: 1

Related Questions