2013-04-22 37 views
1

當我開始在生產模式serven,我得到這個頁面:的Rails 4.0:ActionController的:: RoutingError

"The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved." 

應用程序不能正常工作時的發展模式。

這裏是我的日誌:

I, [2013-04-22T11:27:17.618777 #15685] INFO -- : Started GET "/" for 127.0.0.1 at 2013-04-22 11:27:17 +0400 
F, [2013-04-22T11:27:17.620365 #15685] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/"): 
    actionpack (4.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' 
    actionpack (4.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
    railties (4.0.0.beta1) lib/rails/rack/logger.rb:38:in `call_app' 
    railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `block in call' 
    activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `block in tagged' 
    activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:25:in `tagged' 
    activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `tagged' 
    railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `call' 
    actionpack (4.0.0.beta1) lib/action_dispatch/middleware/request_id.rb:21:in `call' 
    rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' 
    rack (1.5.2) lib/rack/runtime.rb:17:in `call' 
    activesupport (4.0.0.beta1) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
    actionpack (4.0.0.beta1) lib/action_dispatch/middleware/static.rb:64:in `call' 
    railties (4.0.0.beta1) lib/rails/engine.rb:510:in `call' 
    railties (4.0.0.beta1) lib/rails/application.rb:96:in `call' 
    rack (1.5.2) lib/rack/lock.rb:17:in `call' 
    rack (1.5.2) lib/rack/content_length.rb:14:in `call' 
    rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service' 
    /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' 
    /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' 
    /home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' 

我的Gemfile:

ruby "1.9.3" 
source 'https://rubygems.org' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.0.0.beta1' 

gem 'execjs' 
gem 'therubyracer' 

#gem 'sqlite3' 
gem 'pg' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 4.0.0.beta1' 
    gem 'coffee-rails', '~> 4.0.0.beta1' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', platforms: :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

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.0.1' 
+3

你可以列出你的路由在這裏提交內容請? – 2013-04-22 07:40:14

+1

當您在開發模式下點擊「/」時,是否顯示靜態索引頁? – manoj 2013-04-22 09:23:59

+0

ty,我以爲rails 4會自動生成索引頁。 – vladimirich 2013-04-23 06:00:18

回答

1

在Rails 4.0.0部署到生產的時候,你將需要生成/創建索引頁應位於在public/index.html中。

我已經使用此修復方法成功部署在Amazon EC2(AWS)上。

例如:

$ rails generate controller welcome index 
相關問題