You install EspoCRM and it’s so darn good and you come to depend on it so much. Then one day it suddenly stops working. No update, no other software installed, no modifications.. it just stops working and you are freaking out every time you refresh and see EspoCRM Error 500.
Error 500 on an EspoCRM installation can be caused by a variety of problems, but if you suddenly find yourself unable to use EspoCRM without having added/installed any software or performed updates, it could be that your Espo container has run out of disk space.
To check run the command du -h -x -d21
Check the output for disk usage as shown below. Our EspoCRM container was only 100Gb and as you can see, the /var directory occupied a vast majority of that followed by the others, having reached 100% in total. The result was Error 500 or nginx 504 Gateway Time-out.

To find out what exactly is taking up the space, you can run the command du -sh followed by the directory name until reaching the hog directory.
In the example below, you see how running the command and inspecting each directory shows the directory size.

I will save you some time by telling you that the likely offending directory is /var/www/espocrm/data/espocrm/data/logs

The logs can accumulate and take up a lot of space if you don’t clean them out regularly. Remove the oldest logs using the rm command and restart the server.
Once the server restarts and the daemons are running, refresh the EspoCRM Web page and voila!
