The reason this occurs is because when you close your SSH session, your SSH server kills all the processes you had running.
Solutions offered here so far talk about using
screen - which basically lets you disconnect from a terminal session, log out, and then reconnect to it at a later date - leaving all your processes still running.
This solution, however, does not take into account your server process crashing, the server restarting, or something else weird happening.
To that end, I recommend you investigate how to create a system service for your server. How one defines such a thing varies from system to system, but the genera principle is that a service is started by your server automatically once it's dependencies have started up, and will optionally restart it if it dies. You can even ask many programs to save their output to a log file instead of writing to the standard output.
If you have the
systemctl command in your terminal, you probably have systemd. Here's a tutorial I found on setting up a minecraft service file for systemd-based systems.
If you don't have
systemctl, then you probably have either an OpenRC-based or an upstart-based system. In these cases, you should investigate the existing services in
/etc/init.d, and create your own based on that. (If anyone knows of a good tutorial on the subject, please edit t!)