Search code examples
ruby-on-railspuma

Rails server start/stop


To run the Rails server, I use $rails server. It says 'To stop, click Ctrl+c'. I use Putty.

The questions are:

  1. Should I keep the terminal open always? Because if the server stops, my web page wouldn't work. With Apache I just used commands apachectl start/stop.

  2. What if I want to use a command? Should I stop the server, use command, and run again? Because in the same terminal I can't do enything if the server run.


Solution

  • you can run it in background by writing

    daemonize true
    

    in your puma.rb file

    To stop you need to find your running puma process

     ps aux | grep puma
    

    then you need to kill the main process

     sudo kill -9 your process id
    

    to start you need to type

     puma -C config/puma.rb