You reboot your Ubuntu VPS, navigate to your ERPNext domain, and instead of the familiar login screen, you are greeted with:
500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
This is one of the most common issues on ERPNext instances deployed via the official easy install script or standard bench setups. In this guide, we diagnose the root causes and provide the exact commands to restore your ERPNext system immediately.
Why Does This Happen After a Reboot?
When a Linux server restarts, several interdependent systemd and supervisor services must initialize in a specific sequence:
- MariaDB / MySQL Server: If MariaDB fails to bind its socket or hasn’t finished recovery, Frappe cannot query site configuration.
- Redis Services: Frappe requires three distinct Redis instances (
redis-cache,redis-queue,redis-socketio). If one fails, the WSGI app crashes. - Supervisor Workers: Gunicorn worker processes may crash or timeout if spawned before Redis or MariaDB are healthy.
- Supervisor Auto-Start: The supervisor daemon itself may not be enabled to start on system boot.
Step 1: Check Supervisor & Service Status
SSH into your server and check the status of all Frappe services:
sudo supervisorctl status
In a healthy system, you should see all processes in the RUNNING state:
frappe-bench-workers:frappe-bench-frappe-schedule RUNNING
frappe-bench-workers:frappe-bench-frappe-default-worker-0 RUNNING
frappe-bench-workers:frappe-bench-frappe-short-worker-0 RUNNING
frappe-bench-workers:frappe-bench-frappe-long-worker-0 RUNNING
frappe-bench-web:frappe-bench-frappe-web RUNNING
frappe-bench-web:frappe-bench-node-socketio RUNNING
If any service is FATAL, BACKOFF, or STOPPED, proceed to the fixes below.
Step 2: Verify MariaDB and Redis Status
Check if MariaDB and Redis are active:
sudo systemctl status mariadb
sudo systemctl status redis-server
If MariaDB is stopped, start and enable it:
sudo systemctl start mariadb
sudo systemctl enable mariadb
If you encounter Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock', check your disk space:
df -h
(If your root disk partition is 100% full due to unrotated logs, MariaDB cannot start until you free up space!)
Step 3: Restarting Frappe Bench Processes Cleanly
Switch to your frappe user account:
su - frappe
cd /home/frappe/frappe-bench
Restart all workers and web processes via supervisor:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart all
Or using bench directly:
bench restart
Step 4: Reload Nginx Reverse Proxy
Nginx acts as the frontend reverse proxy forwarding traffic to Gunicorn port 8000:
sudo nginx -t
sudo systemctl reload nginx
If nginx -t reports syntax errors in your site configuration, re-generate the config files:
bench setup nginx
sudo systemctl reload nginx
Step 5: Enable Auto-Start on System Boot
To prevent this issue from happening on future reboots, ensure all supervisor and bench services are enabled on system boot:
sudo systemctl enable supervisor
sudo systemctl enable mariadb
sudo systemctl enable redis-server
sudo systemctl enable nginx
Summary
Following this diagnostic checklist will resolve 95% of post-reboot ERPNext 500 errors in under 3 minutes.
Need proactive 24/7 server monitoring, automated database backups, or custom ERPNext maintenance retainers? Talk to the DevOps team at Klickspell.