実現したいこと
AWSで設定し、webサーバーに自作ページが表示されるように設定したい。
前提
・自作ページはrails で記載しています。
・ローカルではページが表示できています。
・nginxの起動(自動起動も)済み
・puma起動済み
発生している問題・エラーメッセージ
ログの内容更新しました
[ec2-user@ip-172-31-12-75 inugo]$ sudo tail -f log/production.log [cd036ade-25f6-4fd1-a83b-78f41a15569e] I, [2024-04-04T13:29:47.676781 #8398] INFO -- : [b4a92c44-5c12-4a6e-bb88-03685c4236da] Started GET "/node/kor/113/main" for 87.246.7.86 at 2024-04-04 13:29:47 +0000 F, [2024-04-04T13:29:47.677283 #8398] FATAL -- : [b4a92c44-5c12-4a6e-bb88-03685c4236da] [b4a92c44-5c12-4a6e-bb88-03685c4236da] ActionController::RoutingError (No route matches [GET] "/node/kor/113/main"): [b4a92c44-5c12-4a6e-bb88-03685c4236da] I, [2024-04-04T13:42:01.034595 #8398] INFO -- : [3d70abee-76af-4431-81f2-7876531099a8] Started GET "/" for 193.3.23.126 at 2024-04-04 13:42:01 +0000 I, [2024-04-04T13:42:01.035322 #8398] INFO -- : [3d70abee-76af-4431-81f2-7876531099a8] Processing by User::HomesController#top as HTML I, [2024-04-04T13:42:01.035929 #8398] INFO -- : [3d70abee-76af-4431-81f2-7876531099a8] Rendered user/homes/top.html.erb within layouts/application (Duration: 0.0ms | Allocations: 4) I, [2024-04-04T13:42:01.037546 #8398] INFO -- : [3d70abee-76af-4431-81f2-7876531099a8] Rendered layout layouts/application.html.erb (Duration: 1.7ms | Allocations: 908) I, [2024-04-04T13:42:01.037733 #8398] INFO -- : [3d70abee-76af-4431-81f2-7876531099a8] Completed 200 OK in 2ms (Views: 2.0ms | Allocations: 1212) I, [2024-04-04T13:51:24.250612 #8398] INFO -- : [a4507957-060f-4fdf-a356-013417cdbf7b] Started GET "/users/sign_in" for 14.11.8.34 at 2024-04-04 13:51:24 +0000 I, [2024-04-04T13:51:24.251385 #8398] INFO -- : [a4507957-060f-4fdf-a356-013417cdbf7b] Processing by User::SessionsController#new as HTML I, [2024-04-04T13:51:24.253149 #8398] INFO -- : [a4507957-060f-4fdf-a356-013417cdbf7b] Rendered user/sessions/new.html.erb within layouts/application (Duration: 0.6ms | Allocations: 384) I, [2024-04-04T13:51:24.254614 #8398] INFO -- : [a4507957-060f-4fdf-a356-013417cdbf7b] Rendered layout layouts/application.html.erb (Duration: 2.1ms | Allocations: 1240) I, [2024-04-04T13:51:24.254791 #8398] INFO -- : [a4507957-060f-4fdf-a356-013417cdbf7b] Completed 200 OK in 3ms (Views: 2.5ms | Allocations: 1867) I, [2024-04-04T13:51:25.756831 #8398] INFO -- : [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] Started GET "/shops/accommodation" for 14.11.8.34 at 2024-04-04 13:51:25 +0000 I, [2024-04-04T13:51:25.757571 #8398] INFO -- : [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] Processing by User::ShopsController#accommodation as HTML I, [2024-04-04T13:51:25.765147 #8398] INFO -- : [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] Completed 500 Internal Server Error in 7ms (ActiveRecord: 1.0ms | Allocations: 1136) F, [2024-04-04T13:51:25.765816 #8398] FATAL -- : [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] NoMethodError (undefined method `shops' for nil:NilClass @shops = target_genre.shops ^^^^^^): [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] [2e81664e-e4ca-4161-91d5-6ebd2f0cbe52] app/controllers/user/shops_controller.rb:5:in `accommodation' I, [2024-04-04T13:51:27.628818 #8398] INFO -- : [84cdd216-809e-43c6-86a9-4ebefc52e6c9] Started GET "/shops/shopping_mall" for 14.11.8.34 at 2024-04-04 13:51:27 +0000 I, [2024-04-04T13:51:27.629557 #8398] INFO -- : [84cdd216-809e-43c6-86a9-4ebefc52e6c9] Processing by User::ShopsController#shopping_mall as HTML I, [2024-04-04T13:51:27.632454 #8398] INFO -- : [84cdd216-809e-43c6-86a9-4ebefc52e6c9] Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.6ms | Allocations: 1037) F, [2024-04-04T13:51:27.633118 #8398] FATAL -- : [84cdd216-809e-43c6-86a9-4ebefc52e6c9] [84cdd216-809e-43c6-86a9-4ebefc52e6c9] NoMethodError (undefined method `shops' for nil:NilClass @shops = target_genre.shops ^^^^^^): [84cdd216-809e-43c6-86a9-4ebefc52e6c9] [84cdd216-809e-43c6-86a9-4ebefc52e6c9] app/controllers/user/shops_controller.rb:11:in `shopping_mall'
上記を見るに、
・ActionControllerルーティングエラーが/node/kor/113/mainにでている
・accommodationとshopping_mallのshops_controller.rbにあるshopsがnilだということ
が主な原因だと思うのですが、
ローカル(rails s)では問題なく表示されており、rails c でデータが入っているか確認しましたら、しっかり入っていました。
回答1件
あなたの回答
tips
プレビュー