【发布时间】:2013-01-23 06:12:00
【问题描述】:
我在运行 sinatra 服务器时遇到问题。
我安装了 RVM 并编写了一个简单的 sinatra 应用程序,来源如下。我也创建了 public + tmp + tmp/restart.txt 文件夹。我在这里关注了一些答案/关于如何设置 GEM_PATH/GEM_HOME 的文章。
该站点是使用“Passenger(仅限 Ruby/Python 应用程序)”选项定义的。
如果我在 SSH 中使用命令行运行独立乘客,它可以在端口 3000 上正常工作(使用公共 URL,例如http://domain.com:3000)。所以这意味着网站很好,宝石可用,只是与Passenger的连接失败了。
我什至看不到来自 apache 的日志来查看问题所在。 /home/user/domain.com/http/error.log 为空,access.log 填满 500s。 浏览器报错500,Internal Server Error,没有任何线索。
我安装 RVM 的用户是此帐户的完全管理员。
我错过了什么?
# config.ru
# I made sure the path is correct and that all the gems I need are installed there
ENV['GEM_PATH'] = '/home/<MY USERNAME>/.rvm/gems/ruby-1.9.3-p362'
# I tried also setting GEM_HOME instead and with GEM_PATH
require 'rubygems'
Gem.clear_paths
require 'sinatra'
require File.expand_path('../server.rb', __FILE__)
run Sinatra::Application
# server.rb
require 'sinatra'
get '/' do
"Worked on dreamhost"
end
get '/foo/:bar' do
"You asked for foo/#{params[:bar]}"
end
【问题讨论】:
-
只是一个小提示。我敢打赌,在 DreamHost 上,某个地方有一个控制面板,您可以在那里找到对错误日志的访问。
-
唯一提到的日志是我提到的目录,它有一个空的error.log。
-
有可能的答案:
The reason is that Passenger Phusion is tied to the version of Ruby installed in /usr/lib, which you can't change without root access. Even though you can install any version of Ruby with RVM, you won't get Passenger to talk to it and therefore your rails project won't use its gems.虽然它适用于 BlueHost,但我认为它适用于 DreamHost。 http://stackoverflow.com/questions/12627313/rails-bluehost-error-ruby-rack-application-could-not-be-started
标签: ruby sinatra passenger dreamhost