不是有效的目录(没有在网上找到答案)

时间:2012-05-20 20:17:50

标签: ruby-on-rails apache passenger redmine

这是我的问题,我在ubuntu 12下安装了标准的rails和redmine。 我有这个错误: 目录“/ var / www”似乎不是有效的Ruby on Rails应用程序根目录。

这似乎是一个常见的错误,但网上没有解决方案: 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

这是我的默认文件:

<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

和我的passenger.conf:

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

我不明白为什么...... 问候 比西耶尔

3 个答案:

答案 0 :(得分:5)

您应该将Document Root指向rails app中的public骰子

DocumentRoot /var/www/YOUR_APP_NAME/public

[...]

<Directory /var/www/YOUR_APP_NAME/public>

答案 1 :(得分:1)

对于Passenger下的Rails应用程序,

DocumentRoot应该是应用程序的public目录。

答案 2 :(得分:1)

某些安装说明在创建符号链接时出错。 正确的符号链接如下使用。

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

vhost应该是这样的:

<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>