我有一个RoR网络应用程序,我试图在阿帕奇上为乘客提供服务。奇怪的是,如果我使用Passenger Standalone,我可以访问web应用程序,但我似乎无法使用带有Passenger模块的Apache来访问web应用程序。
passenger模块似乎正在运行,因为我可以毫无错误地启动Apache,并且Passenger-status返回以下内容:
----------- General information -----------
max = 6
count = 0
active = 0
inactive = 0
Waiting on global queue: 0
----------- Application groups ----------- 当我尝试访问web应用程序时,我得到了公共文件夹目录的列表。
这是我的虚拟主机文件:
<VirtualHost *:80>
ServerAdmin smith@example.com
DocumentRoot /home/smith/www/dashboard/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/smith/www/dashboard/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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
</VirtualHost>我的apache2.conf文件的末尾有以下内容:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger 3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby1.8我正绞尽脑汁想弄清楚这件事。希望能帮上忙。
谢谢。
发布于 2012-02-20 06:44:39
经过几周的试验和错误,我终于能够通过RTFM修复这个问题。令我惊讶的是,我在Stackoverflow上的问题没有得到回应,我在其他地方也找不到任何其他文章来帮助我回答我的问题。这个问题肯定会影响到每一个使用Capistrano在运行Apache2和Passenger的Linux服务器上部署RoR应用程序的人。
我让Capistrano将应用程序部署到/home/smith/www/dashboard,这将创建一个当前文件夹,该文件夹符号链接到releases/
Passenger需要找到config/environment.rb ment.rb来启动Rails应用程序。默认情况下,Phusion Passenger假定应用程序的根目录是公共directory.See的父目录:http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerAppRoot
问题是,当使用Capistrano时,默认情况下它会将应用程序部署到
/home/smith/www/dashboard/current/
因此,默认情况下,Passenger认为路径为:
/home/smith/www/dashboard/config/environment.rb
Passenger提供了在Apache虚拟主机文件中设置PassengerAppRoot配置选项的能力,如下所示:
PassengerAppRoot /home/smith/www/dashboard/current
这使乘客能够正确地找到config/environment.rb ment.rb文件:
PassengerAppRoot /home/scervera/www/dashboard/current/config/environment.rb
下面是我的虚拟主机文件的其余部分:
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /home/smith/www/dashboard/current/public
<Directory /home/smith/www/dashboard/current/public>
Options FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
PassengerAppRoot /home/smith/www/dashboard/current
</VirtualHost>也许还有其他方法可以解决这个问题,但我相信这是“照本宣科”的。
https://stackoverflow.com/questions/9253117
复制相似问题