Rails5でpumaからnginxに変更したいのですが、
どうもうまくいきません。
色々なサイトを見ながらやってますが、いまいちわかりません
知恵を貸して頂きたいです。
主に参考にしたサイト
→ https://qiita.com/hiroky_814/items/72a13dbedd36e88ca599
AWS EC2で作業
###やったこと
ruby
1Gemfileでpumaをコメントアウトしunicornを記載 2 $vi Gemfile 3 #gem 'puma' コメントアウト 4 gem 'unicorn' 5 6bundle install実行 7$bundle install --path vendor/bundle 8 9config配下にunicorn.rbを作成し下記内容を記載 10 $vi config/unicorn.rb 11 rails_root = ENV['RAILS_ROOT'] 12 worker_processes Integer(ENV['WEB_CONCURRENCY'] || 1) 13 timeout 300 # タイムアウト 14 preload_app true # 更新時ダウンタイム無し 15 16 # listen 8080 17 listen "#{rails_root}/tmp/unicorn.sock" 18 pid "#{rails_root}/tmp/unicorn.pid" 19 20 # ログの出力 21 stderr_path File.expand_path('log/unicorn.log', rails_root) 22 stdout_path File.expand_path('log/unicorn.log', rails_root) 23 24ここで参考サイトでDockerFileの設定があったがDockFileがどこにあるのかわからずスキップ 25 26development.ebに下記内容を追加 27 $vi config/environments/development.rb 28 config.logger = ActiveSupport::Logger.new(STDOUT) 29 30rails sで起動 31$bundle exec rails s 32$ bundle exec rails s 33=> Booting WEBrick 34=> Rails 5.2.0 application starting in development on http://localhost:3000 35=> Run `rails server -h` for more startup options 36[2018-10-12 14:42:43] INFO WEBrick 1.4.2 37[2018-10-12 14:42:43] INFO ruby 2.5.1 (2018-03-29) [x86_64-linux] 38[2018-10-12 14:42:43] INFO WEBrick::HTTPServer#start: pid=2899 port=3000 39 40しかし、URLにアクセスしても502 nginxが出て反応がない
###回答から追記
エラー内容をみると
in `require': cannot load such file -- rack/handler/unicorn (LoadError)
ここが問題のようです
$ bundle exec rails s unicorn Exiting Traceback (most recent call last): 27: from bin/rails:9:in `<main>' 26: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require' 25: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency' 24: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require' 23: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require' 22: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi' 21: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register' 20: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi' 19: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require' 18: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>' 17: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke' 16: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform' 15: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch' 14: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' 13: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run' 12: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform' 11: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap' 10: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform' 9: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:47:in `start' 8: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:76:in `print_boot_information' 7: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:105:in `use_puma?' 6: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/server.rb:301:in `server' 5: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/handler.rb:16:in `get' 4: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/handler.rb:74:in `try_require' 3: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require' 2: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency' 1: from /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- rack/handler/unicorn (LoadError)
###回答からさらに追記
後ろに -D developmentをつけたところ下記エラーが出てきました
$ bundle exec unicorn_rails -c config/unicorn.rb -D development bundler: failed to load command: unicorn_rails (/home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/bin/unicorn_rails) ArgumentError: rackup file (development) not readable /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:702:in `parse_rackup_file' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:86:in `reload' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/lib/unicorn/configurator.rb:77:in `initialize' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:77:in `new' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:77:in `initialize' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `new' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/gems/unicorn-5.4.1/bin/unicorn_rails:209:in `<top (required)>' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/bin/unicorn_rails:23:in `load' /home/kkawahara/workspace/working/webex/vendor/bundle/ruby/2.5.0/bin/unicorn_rails:23:in `<top (required)>' master failed to start, check stderr log for details

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/12 06:18
2018/10/12 06:23
2018/10/12 06:24
2018/10/12 06:26
2018/10/12 06:30
2018/10/12 06:33 編集
2018/10/12 06:35
2018/10/12 06:38
2018/10/12 06:45
2018/10/12 06:54
2018/10/12 07:10
2018/10/12 07:16
2018/10/12 07:22
2018/10/12 07:29
2018/10/12 07:41
2018/10/12 07:42
2018/10/12 07:59
2018/10/12 08:13
2018/10/12 08:24
2018/10/12 08:26
2018/10/12 08:31
2018/10/12 08:35
2018/10/12 08:40
2018/10/12 08:42 編集
2018/10/12 08:42
2018/10/12 08:42
2018/10/12 08:43
2018/10/12 08:47 編集
2018/10/12 08:48
2018/10/12 08:49
2018/10/12 08:54
2018/10/12 08:55
2018/10/12 08:56