When your server is running low on memory you should seriously consider to upgrade it. However, you can also dedicate some disk space as swap memory. When it's used your applications will run slower, but at least they won't crash (unless you also exhaust the swap memory, of course).

In order to enable 1GB of swap memory on your server, just log into it as user moss (via SSH) and run the following commands:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf

In case you need more or less swap, just adjust the first line accordingly.

Did this answer your question?