我正在尝试使用mongrel集群配置旧的rails 2.1应用程序。
使用此配置乘客已在我的系统(apache)上正确安装
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /usr/bin/ruby1.8
RailsSpawnMethod smart
PassengerMaxPoolSize 1
PassengerMaxInstancesPerApp 1
PassengerPoolIdleTime 2000
RailsFrameworkSpawnerIdleTime 0
RailsAppSpawnerIdleTime 0
我的项目位于
/var/sites/site
这是apache配置
<Virtualhost tagi:80>
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/sites/site/current/
#PassengerHighPerformance on
##PassengerMaxRequests 5000
PassengerStatThrottleRate 5
<Directory />
AllowOverride AuthConfig
</Directory>
ErrorLog /var/log/apache2/site-error.log
CustomLog /var/log/apache2/site-access.log combined
ServerSignature Off
</Virtualhost>
使用mongrel app正确启动并完美运行。 但是使用apache2 + passanger,启动不起作用,我从apache获得默认目录列表。
这是配置文件的权限
-rw-r----- 1 git web 2.7K 2009-11-11 11:34 boot.rb
-rw-r----- 1 git web 600 2009-11-11 13:51 database.yml
-rw-r----- 1 git web 1.7K 2009-11-11 11:34 deploy.rb
-rw-r----- 1 git web 3.9K 2009-11-11 14:04 environment.rb
drwxr-x--- 2 git web 4.0K 2009-11-11 11:34 environments
-rw-r----- 1 git web 754 2009-11-11 11:34 gmaps_api_key.yml
drwxr-x--- 2 git web 4.0K 2009-11-11 11:34 initializers
-rw-r----- 1 git web 1.8K 2009-11-11 11:34 routes.rb
我什么都不知道。 apache日志很清楚。
在我的服务器上我已经运行了5个具有相同配置的应用程序。
任何建议?
答案 0 :(得分:0)
在您的应用DocumentRoot
目录中指出public
。我不确定/var/sites/site/current/
是什么,但那可能不是你想要的。
此外,您可以尝试通过将RailsBaseURI /
放入您的虚拟主机中,更明确地向乘客解释您希望它安装rails应用的位置。
试一试,我们可以从那里开始。
答案 1 :(得分:0)
在这个问题上苦苦挣扎。我发现让它工作的方式,特别是在运行具有不同环境(生产,调试,测试等)的多个Passenger实例时,就是这样做:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName server.com
ServerAlias www.server.com
DocumentRoot /var/sites/current/public
RailsBaseURI /current
RailsEnv production
</VirtualHost>
<VirtualHost *:80>
ServerName dev.server.com
DocumentRoot /var/sites/dev-version/public
RailsBaseURI /dev-version
RailsEnv development
</VirtualHost>
然后从/ var / sites /设置sym链接指向
lrwxrwxrwx 1 root root 13 Aug 24 17:41 current -> /code/site5
lrwxrwxrwx 1 root root 19 Aug 24 17:41 test-version -> /code/site-test
lrwxrwxrwx 1 root root 19 Sep 21 09:41 dev-version -> /code/development
这样,Passenger可以区分各个站点,因为它们的所有DocumentRoot路径都不同。如果直接指向代码目录而不是通过符号链接,则可能没有此问题。