When I try to start rails server, I get the following error and may not be able to start it.
$ rails s -b 0.0.0.0 => Booting Puma => Rails 18.104.22.168 application starting in development => Run `rails server -h` for more startup options A server is already running. Check /Directory path/tmp/pids/server.pid. Exiting
This is an error that occurs because the server is already running. Here's what to do in this case.
All you have to do is kill the PID number in /tmp/pids/server.pid. Even if I manually delete the server.pid file, the server is still running, so Execute the following command to find and kill the process running on number 3000.
$ lsof -i:3000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ruby2.5 3033 vagrant 16u IPv4 27499 0t0 TCP *:3000 (LISTEN)
Kill the PID number found by the above command with the following command.
$ kill -9 3033
This will shut down the server and start it fine.