0

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

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

例子:

我使用安装其中一个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

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

4

1 回答 1

0

可能您已经更改了路线并且没有重新启动。为了查看这些更改,您必须重新启动服务。

于 2013-09-01T01:36:32.417 回答