1

这是我的问题,我在 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

和我的乘客.conf:

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

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

4

3 回答 3

5

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

DocumentRoot /var/www/YOUR_APP_NAME/public

[...]

<Directory /var/www/YOUR_APP_NAME/public>
于 2012-05-20T22:11:46.230 回答
1

DocumentRoot对于乘客下的 Rails 应用程序,应该是应用程序的public目录。

于 2012-05-20T21:42:24.253 回答
1

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

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

虚拟主机应该是这样的:

<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>
于 2013-11-01T20:42:49.213 回答