Im using rust knightly, my code is compiling and working, now, I uploaded the code to the server, and my intention is to execute ROCKET_ENV=stage cargo run in background.
Im usin Amazon web services(AWS).
If i run the comand on a console and acces to the url
http://myapli_rust.com its works fine. The problem arrives when I close the console, the process finish and url doesnt work anymore sayin the the site cannot be reached.
If i do ROCKET_ENV=stage cargo run & doestn work neither.
If i run the binary like ./project is works fine till close terminal too
Do cargo build --release and copy target/release/<executable> to some appropriate place (e.g. /usr/bin or some directory dedicated to your project on your server).
For Ubuntu/Debian based OSes you can use cargo-deb to build your code as a Debian package and install it "properly" on the system.
For running it as a server, you can't just run it from the shell. Even if you prevent termination of your executable with nohup, it would still be super fragile, as nothing would monitor or restart it in case of problems. Proper solution would be to configure it as a systemd service.