0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Rails】ローカルサーバーの起動

Last updated at Posted at 2025-04-04

記事概要

ローカルサーバーを起動する方法について、まとめる

前提

  • Ruby on Railsでアプリケーションを作成している
  • 開発環境で下記変更を行なった場合、必ずローカルサーバーの再起動が必要1
    • Rubyバージョンの変更
    • テーブル・カラム情報の変更
    • Gemの導入状況の変更

手順(起動)

  1. rails sコマンドでローカルサーバーを起動する
    # アプリのディレクトリに移動
    % cd ~/[アプリ名]
    
    # ローカルサーバーを起動
    % rails s
    
  2. 下記が表示されると、サーバーが起動している
    => Booting Puma
    => Rails 7.1.4.3 application starting in development 
    => Run `bin/rails server --help` for more startup options
    Puma starting in single mode...
    * Puma version: 5.6.5 (ruby 3.2.0-p0) ("Birdie's Version")
    *  Min threads: 5
    *  Max threads: 5
    *  Environment: development
    *          PID: 41905
    * Listening on http://127.0.0.1:3000
    * Listening on http://[::1]:3000
    * Listening on http://127.51.68.120:3000
    Use Ctrl-C to stop
    
  3. ブラウザでhttp://localhost:3000にアクセスすると、サーバーに接続できる
    Image from Gyazo

手順(停止)

  1. ターミナル.appでcontrol + Cを同時に押す
  2. サーバーが停止できたことを確認する

Ruby on Railsまとめ

  1. ローカルサーバーの起動時に、1度だけ読み込まれるため

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?