LoginSignup
16
19

More than 5 years have passed since last update.

rails serverコマンドで起動する時のデフォルトポートを変更する方法

Posted at

rails serverでrailsを立ち上げるとデフォルトポートが3000となるが、複数のプロジェクトを同時に立ちあげたい時にポートがかぶってしまうので変更をするための方法。boot.rbに以下を追加する。

3001番ポートにする場合

config/boot.rb
require 'rails/commands/server'
module Rails
  class Server
    def default_options
      super.merge({:Port => 3001})
    end
  end
end
16
19
1

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
16
19