質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

940閲覧

rails s でサーバーにアクセスできない

Atie

総合スコア2

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/12/28 01:39

編集2020/12/28 01:54

前提・実現したいこと

Railsでwebアプリケーションを開発しているのですがサーバーを起動してもアクセスできません

発生している問題・エラーメッセージ

pi@raspberrypi:~/environment/hello_app$ rails server -b 0.0.0.0 => Booting Puma => Rails 6.0.3 application starting in development => Run `rails server --help` for more startup options Puma starting in single mode... * Version 4.3.6 (ruby 2.6.3-p62), codename: Mysterious Traveller * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://0.0.0.0:3000 Use Ctrl-C to stop

サーバーは起動できますがwebブラウザからアクセスしようとすると
イメージ説明
と表示されてアクセスができません
もちろんconfig/environments/development.rbファイルも編集して以下のようになっています

Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.hosts.clear #Cloud9へのアクセスを許可 end

試したこと

  • ファイヤーウォールの確認(インストールされていませんでした)
  • 0.0.0.0に対してpingを使い応答が帰ってくるかを調べました(pingは帰ってきました)
  • 設定が読み込まれていないかもしれないのでreboot(それでも状況は変わらず...)
  • ポートの指定なしでlocalhostにアクセスしてみましたが接続拒否されました

補足情報(FW/ツールのバージョンなど)

Railsチュートリアルにそって進めています

Rubyバージョン 2.6.3
Railsバージョン 6.0.3
ブラウザ Brave
RailsチュートリアルはRails6.0(第6版)の第一章です

参考になるかはわかりませんがGemfileの内容もおいておきます

Gemfile

1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4gem 'rails', '6.0.3' 5gem 'puma', '4.3.6' 6gem 'sass-rails', '5.1.0' 7gem 'webpacker', '4.0.7' 8gem 'turbolinks', '5.2.0' 9gem 'jbuilder', '2.9.1' 10gem 'bootsnap', '1.4.5', require: false 11 12group :development, :test do 13 gem 'sqlite3', '1.4.1' 14 gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] 15end 16 17group :development do 18 gem 'web-console', '4.0.1' 19 gem 'listen', '3.1.5' 20 gem 'spring', '2.1.0' 21 gem 'spring-watcher-listen', '2.0.1' 22end 23 24group :test do 25 gem 'capybara', '3.28.0' 26 gem 'selenium-webdriver', '3.142.4' 27 gem 'webdrivers', '4.1.2' 28end 29 30# Windows ではタイムゾーン情報用の tzinfo-data gem を含める必要があります 31gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

ご回答お待ちしております

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2020/12/28 01:40

ポート指定せずにrailse s した場合はlocalhostなどでアクセスできているのでしょうか。
m.ts10806

2020/12/28 01:41

>Railsチュートリアルにそって進めています 念のため、現在見ている章と項をご提示ください。
Atie

2020/12/28 01:45

>ポート指定せずにrailse s した場合はlocalhostなどでアクセスできているのでしょうか。 今試してみましたが同じように接続拒否されてしまいました
m.ts10806

2020/12/28 02:13

ただ、そもそもRailsのデフォルトポートって3000だったような。 チュートリアルにも8000って書いてません。
technocore

2020/12/28 02:54 編集

* Environment: development * Listening on tcp://0.0.0.0:3000 Use Ctrl-C to stop 明らかに3000ですよね。メッセージを読まない人なのでしょう。
m.ts10806

2020/12/28 03:39

間違いない操作の基本はコピペです。
Atie

2020/12/28 05:37

確かにポートが3000でした! 全然メッセージを読んでいませんでした ありがとうございます
guest

回答1

0

ベストアンサー

投稿2020/12/28 01:42

asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問