Backups and security
Your data is your business. This page explains what to back up, how often and where to keep it, how to test it, and the basic steps that keep your site safe.
2 min read
What to back up
| What | Where it is | Why |
|---|---|---|
| The database | MySQL or MariaDB | All of your sales, stock and customers. |
| Uploaded files | storage/app | Product photos, attachments and documents. |
| Files on records | storage/app/private | CVs, expense receipts, uploaded bills, signed reports and message attachments. They cannot be opened by a public link, and an update moves older files here. Website images stay public on purpose. |
| Your settings | .env | Database password and application key. Without the key, some data cannot be read. |
How often
Back up the database every night, for example with mysqldump, using your server's scheduler. Keep the last 14 days, plus one a month for a year.
Test it
A backup you have never restored is only a hope. Twice a year, restore one to a test server, and check that you can sign in and see yesterday's sales. Note how long it took, because that is how long you could be closed in a real emergency.
Keep your site safe
- Keep
APP_DEBUG=falseandAPP_ENV=productionon a live site. Debug pages can show passwords. - Serve the site over HTTPS only.
- Keep
.envprivate, and never in a public folder. - Give each person their own account, with the lowest role they need.
- Turn on two-factor authentication for administrators.
- Apply updates when they are released, as they include security fixes.
- Keep PHP up to date, at least 8.3.36, 8.4.27 or 8.5.12, with
session.upload_progress.enabled = 0. See Requirements and installation.
When someone leaves
Remove their login and PIN on their last day. Change any passwords they knew, including your server and mail ones. See A new employee's first month.
If you think that you have been hacked
- Take the site offline.
- Keep a copy of the logs and of the database as they are.
- Change all passwords, including your database password.
- Ask a security professional, and take legal advice if customer data may have been reached. Your country may require you to report it.
- Restore from a clean backup, and bring the site back.