【问题标题】:Not a valid directory (didn't found the answer on the net)不是一个有效的目录(在网上没有找到答案)
【发布时间】:2012-05-27 11:00:50
【问题描述】:

这是我的问题,我在 ubuntu 12 下做了一个标准的 rail 和 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>

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

【问题讨论】:

    标签: ruby-on-rails apache passenger redmine


    【解决方案1】:

    您应该将 DocumentRoot 指向 rails 应用程序内的 public 目录

    DocumentRoot /var/www/YOUR_APP_NAME/public
    

    [...]

    <Directory /var/www/YOUR_APP_NAME/public>
    

    【讨论】:

      【解决方案2】:

      对于一个 Rails 应用程序,Passenger 下的DocumentRoot 应该是应用程序的public 目录。

      【讨论】:

        【解决方案3】:

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

        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>
        

        【讨论】:

          猜你喜欢
          • 2022-01-17
          • 1970-01-01
          • 2019-12-01
          • 2016-08-31
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多