I'd like to bind the rails server to 127.0.0.1, instead of 0.0.0.0 so its not accessible when I'm working from coffee shops.
Is there a configuration file where I can specify this option so I don't have to pass the command line switch:
rails server -b 127.0.0.1
?
If you are searching for Rails 5: Answer
In Rails ~> 4.0
you can customize the boot section of the Server class:
In /config/boot.rb
add this lines:
require 'rails/commands/server'
module Rails
class Server
def default_options
super.merge({Port: 10524, Host: '127.0.0.1'})
end
end
end
As already answered on this questions:
How to change Rails 3 server default port in develoment?
How to change the default binding ip of Rails 4.2 development server?