How to keep server running on EC2 after ssh completes

I have an EC2 instance on which I installed the rails server. The server also works fine when I do

rails server 

But after closing the ssh connection, the server also stops. How can I keep the server running even after closing the ssh connection.

+6
source share
5 answers
 screen rails s 

did the trick

after that CTRL + A + D and I will leave, and the server is working fine

+10
source

Try it. We must start the rails server as a daemon.

 rails s -d & 
+7
source

runs as a server, this means that nginx or apache, or that the development server does not mean running as a server, the user needs additional information https://www.digitalocean.com/community/articles/how-to-install-rails-and-nginx -with-passenger-on-ubuntu also if you want to pre-sololtion use rubber https://github.com/rubber/rubber

+1
source

I needed to run everything, not the rails in the background. An installation screen that makes an additional terminal that is not affected by your ssh connection. sudo apt-get install screen open screen screen then run rails server & .

Press “Crtl + A”, then “D” to exit, and enter screen -r to return to the screen terminal.

+1
source

I recommend using apache or something else instead of a regular rails server, but you can probably add at the end and feel free to leave

 rails server & 
0
source

Source: https://habr.com/ru/post/944440/


All Articles