我正在尝试使用配置了混合集群的旧rails 2.1应用程序。
使用此配置,passenger已正确安装在我的系统(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>与混合应用程序正确启动,并完美地工作。但使用apache2 + passanger时,启动不起作用,我从apache获得默认目录列表。
这是configs文件的权限
-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个应用程序在使用相同的配置运行。
有什么建议吗?
发布于 2009-11-11 21:26:19
将DocumentRoot指向您的应用程序public目录。我不确定/var/sites/site/current/是什么,但这可能不是您想要的。
此外,您还可以通过在vhost中放置RailsBaseURI /来更明确地向乘客解释您希望它在哪里挂载rails应用程序。
试一试,我们可以从那里开始。
发布于 2009-11-11 22:30:46
在这件事上挣扎了很长时间。我发现让它工作的方法,特别是在不同环境(生产、调试、测试等)下运行多个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>然后将sym链接从/var/sites/设置为指向
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这样,乘客可以区分站点之间的差异,因为它们的所有DocumentRoot路径都是不同的。如果您直接指向代码目录,而不是通过符号链接,则可能不会出现此问题。
https://stackoverflow.com/questions/1715121
复制相似问题