Bind rails server to 127.0.0.1 by default

前端 未结 4 887
长发绾君心
长发绾君心 2021-02-19 01:09

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

4条回答
  •  感情败类
    2021-02-19 01:41

    I use Foreman as a process manager in development.

    After adding gem 'foreman' to your Gemfile and running bundle install, create a file Procfile in the root of your application directory.

    While you can add lines to manage other processes, mine just reads:

    web: rails server -p $PORT -b 127.0.0.1
    

    Then, to start the Rails server via the Procfile, run foreman start. If you have other processes here (Redis, workers) they'll boot at the same time.

提交回复
热议问题