【发布时间】:2014-03-21 18:43:34
【问题描述】:
我是 ruby on rails 的新手,我一直在使用 JustHost 来试用我的测试 rails 应用程序。但是,据我了解,JustHost 使用 Phusion Passenger 来部署 rails app。我可以让本地版本工作,它只是一个使用“rails new testapp”创建的新应用程序,但我不断收到此错误:
没有这样的文件或目录 - config.ru
我能够在服务器上运行 rails 并收到以下结果:
=> 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 上的教程进行操作,但仍然无法访问该页面。 my.justhost.com/cgi/help/rails
而且我还将公用文件夹中的 .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>
USER 是我的用户名,APPNAME 是我的 rails 应用程序的名称。
感谢您的所有帮助。
除了以上所有信息,我还附上了我的 Gemfile 作为参考:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
gem 'passenger', :require => false
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'execjs'
gem 'therubyracer', :platforms => :ruby
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
【问题讨论】: