使用ActionController(GET)的RoutingError

时间:2013-09-01 00:35:57

标签: ruby-on-rails nginx unicorn

我正在尝试使用Rails + nginx + unicorn + MongoDB在7个子域中设置7个目录。

实际上,子域是由nginx根文件生成的,并且工作正常,我还没有使用MongoDB。 安装新制作,尚未创建任何页面(我也尝试过),我仍然有404错误,日志中有错误。 当然,如果我在/public中创建一个html页面,则可以正常工作。

示例:

我使用rails new site1

安装其中一个 /var/www/site1

中的

可在http://site1.mydomain.tld

上找到

它会在/var/www/site1/log/production.log

中显示此错误
 I, [2013-09-01T02:12:44.425694 #31368]  INFO -- : Started GET "/" for XXX.XXX.XXX.XXX at 2013-09-01 02:12:44 +0200
F, [2013-09-01T02:12:44.426541 #31368] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/"):
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) 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) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  unicorn (4.6.3) lib/unicorn/http_server.rb:552:in `process_client'
  unicorn (4.6.3) lib/unicorn/http_server.rb:632:in `worker_loop'
  unicorn (4.6.3) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
  unicorn (4.6.3) lib/unicorn/http_server.rb:142:in `start'
  unicorn (4.6.3) bin/unicorn:126:in `<top (required)>'
  /usr/local/bin/unicorn:23:in `load'
  /usr/local/bin/unicorn:23:in `<main>'

我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.0.0'
gem 'bson_ext'

# mongoDB tool
## gem 'mongoid', '~> 3.0.0'
## gem 'mongo', '~> 1.9.2'
#gem 'mongo_mapper'
gem 'sqlite3'

# Use unicorn as the app server
  gem 'unicorn'

# CSS tool
gem 'sass-rails', '~> 4.0.0'

## JQUERY & javascript stuff
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use debugger
# gem 'debugger', group: [:development, :test]

我的config/unicorn.rb文件:

root = "/var/www/site1"
 working_directory root
 pid "#{root}/tmp/pids/unicorn.pid"
 stderr_path "#{root}/log/uni-err.log"
 stdout_path "#{root}/log/uni-out.log"

 listen "/tmp/site1-unicorn.test.sock"
 worker_processes 2
 timeout 30

任何帮助都会有用。谢谢!

1 个答案:

答案 0 :(得分:0)

可能您已对路线进行了更改并且未重新启动。要查看这些更改,您必须重新启动该服务。