Ruby on rails 4 如何在服务器上启动后访问rails应用程序

Ruby on rails 4 如何在服务器上启动后访问rails应用程序,ruby-on-rails-4,passenger,Ruby On Rails 4,Passenger,我是RubyonRails新手,我一直在使用JustHost尝试我的测试rails应用程序。然而,据我了解,JustHost使用Phusion Passenger部署rails应用程序。我可以让本地版本正常工作,它只是使用“rails NewTestApp”创建的一个新应用程序,但我不断遇到以下错误: 没有这样的文件或目录-config.ru 我能够在服务器上运行rails s并收到以下结果: => Booting WEBrick => Rails 4.0.3 application

我是RubyonRails新手,我一直在使用JustHost尝试我的测试rails应用程序。然而,据我了解,JustHost使用Phusion Passenger部署rails应用程序。我可以让本地版本正常工作,它只是使用“rails NewTestApp”创建的一个新应用程序,但我不断遇到以下错误:

没有这样的文件或目录-config.ru

我能够在服务器上运行rails s并收到以下结果:

=> Booting WEBrick
=> Rails 4.0.3 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-03-21 12:35:49] INFO  WEBrick 1.3.1
[2014-03-21 12:35:49] INFO  ruby 1.9.3 (2013-05-15) [x86_64-linux]
[2014-03-21 12:35:49] INFO  WEBrick::HTTPServer#start: pid=17181 port=3000
运行bundle exec passenger start可获得以下信息:

=============== Phusion Passenger Standalone web server started ===============
PID file: /home4/USER/APPNAME/tmp/pids/passenger.3000.pid
Log file: /home4/USER/APPNAME/log/passenger.3000.log
Environment: development
Accessible via: http://0.0.0.0:3000/

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check http://www.modrails.com/documentation/Users%20guide%20Standalone.html#troubleshooting
===============================================================================
App 23867 stdout: 
[ 2014-03-21 12:36:54.9704 23567/7f2d68154700 Pool2/SmartSpawner.h:301 ]: Preloader for /home4/USER/APPNAME started on PID 23867, listening on unix:/tmp/passenger.1.0.23557/generation-0/backends/preloader.23867
App 24159 stdout: 


Started HEAD "/" for 127.0.0.1 at 2014-03-21 12:36:55 -0600
Processing by Rails::WelcomeController#index as HTML
  Rendered /home4/USER/ruby/gems/gems/railties-4.0.3/lib/rails/templates/rails/welcome/index.html.erb (4.8ms)
Completed 200 OK in 92ms (Views: 54.4ms | ActiveRecord: 0.0ms)
我遵循了JustHost上的教程,但仍然无法访问该页面

我还将公用文件夹中的.htaccess修改为以下内容,但没有成功。更改为以下代码后,当我访问rails应用程序的公用文件夹时,我会看到文件夹中的文件列表,例如404.html、422.html等

<IfModule mod_passenger.c>
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
#Set this to work with Phusion Passenger online 
RackBaseURI /home4/USER/APPNAME
SetEnv GEM_HOME /home1/examplec/ruby/gems
</IfModule>

我也有同样的问题。我花了一个小时才弄明白

No such file or directory - config.ru
这一行告诉你问题所在。它找不到“config.ru”文件。config.ru文件的我的版本如下:

# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
run Broadsheet::Application
对我来说,这个config.ru文件位于我的“/home4/USER/rails\u apps/APPNAME”文件夹中,因此它可能位于您的“/home4/USER/APPNAME”文件夹中。它是自动生成的,所以它不是我自己添加的东西,但你可能不得不这样做

由于Passenger找不到此config.ru文件,可能是我指定的文件夹中缺少该文件,或者“home4/USER/APPNAME/public/.htaccess”文件中有错误,尤其是以下行:

RackBaseURI /home4/USER/APPNAME
这是Passenger用来查找config.ru文件的目录。我会仔细检查以确保这行的某个地方没有打字错误



作为旁注,目前我已经消除了乘客错误,但除了公用文件夹中的静态页面之外,我仍然无法获得任何视图或任何东西来显示或不给我404未找到的错误

谢谢你的回复,但这并没有解决我的问题。我认为我的cpanel不支持rails4,但它可以与我的rails3应用程序配合使用。
RackBaseURI /home4/USER/APPNAME