1

This is my step

  1. Made a new instance in Amazon EC2

  2. connect to the ec2 instance with ssh client

  3. git cloned a Ruby on Rails app

  4. run the server with rails s

  5. try to connect to the url : EC2PUBLICIP:3000

  6. ok it works!

  7. closed the ssh client terminal

  8. now i cannot connect :(

Do I have to keep retaining the ssh client from my local pc to run the instance server????

Canna
  • 3,614
  • 5
  • 28
  • 33

2 Answers2

0

Try this

rails server &

This will run the server in the background, so it will not be stopped when the ssh connection is closed

Slicedpan
  • 4,995
  • 2
  • 18
  • 33
  • yup, i tried that before, but strangly, it doesn't work :( if i reconnect to ssh client and check the process, it is not on the list – Canna Feb 20 '14 at 13:46
0

For a process to continue after you close the console you need to use nohup

nohup rails server &

But note that if your machine is restarted, there is nothing to start your server automatically. For better production-ready application, look at solutions like the ones mentioned here: Ruby on Rails Server options

Community
  • 1
  • 1
Uri Agassi
  • 36,848
  • 14
  • 76
  • 93