LoginSignup
12
9

More than 3 years have passed since last update.

rails sとは localhostとは

Last updated at Posted at 2020-01-24

Railsでアプリケーションをローカルで起動する際に
ターミナルでrails s実行し
ブラウザでlocalhost:3000を入力すると表示されると思います。

これって何をしてるのと疑問に思ったので書いてみました。

rails sについて

まず、railsのアプリを起動する為にはアプリケーションサーバを起動する必要があります。
それを担っているのが、rails sです。
rails sを実行するとpumaと呼ばれるアプリケーションサーバが起動します。

下の =>Booting Pumaです。

$rails s
=> Booting Puma
=> Rails 5.0.7.2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.3.1-p112), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

つまりrails sでアプリケーションサーバを起動しています。

localhost:3000について

localhost:3000とは自身のPCを指すドメインの事です。

つまり自身のPCをアプリケーションサーバにみたてて(rails sで)ブラウザでlocalhost:3000というドメインにアクセスさせる事で自身の書いたアプリケーションが表示されているという事です!

12
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
9