You install EspoCRM and one day, out of the blue, it suddenly stops working. No update, no other software installed, no modifications.. it just stops working and every time you refresh you 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.

Managed IT Service FOSS Espo CRM

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.

IT Support Miami Open Source Espo CRM

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!

If you want to avoid future incidents, you can easily create a cron job to delete logs older than n days old.

At the command prompt, type the command:

crontab -e

Edit the crontab file with your favorite editor and enter the following line:

0 0 * * * find /var/www/espocrm/data/espocrm/data/logs/*.log -mtime +7 -exec rm -f {} \;

Save the file and the cron job will delete log files older than 7 days.

Leave a comment

Your email address will not be published. Required fields are marked *

error: Sorry, copy/paste is disabled
Skip to content