使用Apache2和Passenger启动Rails应用程序时显示目录根

使用Apache2和Passenger启动Rails应用程序时显示目录根,apache2,ruby-on-rails-3.2,passenger,Apache2,Ruby On Rails 3.2,Passenger,为了使用Apache 2.2.21和Passenger 3.0.13托管Rails 3.2.3应用程序,我做了以下工作: 已安装的gem乘客 rvmsudo乘客-安装-apache2-模块 在/etc/apache2/extra/httpd-vhosts.conf中添加了网站信息 向/etc/hosts添加了一行,但不确定是否需要这样做;乘客文件中未提及 取消注释/etc/apache2/httpd.conf中的行,以包括/etc/apache2/extra/httpd-vhosts.conf

为了使用Apache 2.2.21和Passenger 3.0.13托管Rails 3.2.3应用程序,我做了以下工作:

已安装的gem乘客 rvmsudo乘客-安装-apache2-模块 在/etc/apache2/extra/httpd-vhosts.conf中添加了网站信息 向/etc/hosts添加了一行,但不确定是否需要这样做;乘客文件中未提及 取消注释/etc/apache2/httpd.conf中的行,以包括/etc/apache2/extra/httpd-vhosts.conf 重新启动Apache 当我尝试打开我的网站时,会显示以下内容:

Index of /

    Name    Last modified   Size    Description

Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.10 with Suhosin-Patch Phusion_Passenger/3.0.13 Server at lightbesandbox2.com Port 443
以下是网站的/etc/hosts条目:

127.0.0.1   www.lightbesandbox2.com
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName www.lightbesandbox2.com
  ServerAlias lightbesandbox2.com
  PassengerAppRoot /Users/server1/Sites/iktusnetlive_RoR/ 
  DocumentRoot /Users/server1/Sites/iktusnetlive_RoR/public    
  <Directory /Users/server1/Sites/iktusnetlive_RoR/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
</VirtualHost>
以下是网站的/etc/apache2/extra/httpd-vhosts.conf条目:

127.0.0.1   www.lightbesandbox2.com
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName www.lightbesandbox2.com
  ServerAlias lightbesandbox2.com
  PassengerAppRoot /Users/server1/Sites/iktusnetlive_RoR/ 
  DocumentRoot /Users/server1/Sites/iktusnetlive_RoR/public    
  <Directory /Users/server1/Sites/iktusnetlive_RoR/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
</VirtualHost>
我的所有资产都不在我的Rails应用程序的公用文件夹中。我已经使用MichaelHartl的RubyonRails教程中提供的模板编写了一个应用程序。主页位于/app/views/static_pages/home.html.erb中。我决定复制公用文件夹中的index.html文件,看看它是否会显示。正如我所希望的那样

有没有一种方法可以让乘客在不重写应用程序的情况下找到我的资产

任何帮助都将不胜感激。

也许这会有所帮助

虽然它使用的是NHG 2.1,但您可以使用它作为从步骤7开始设置乘客的指南