How to back up a Laravel application, step by step
Updated 7/20/2026
A complete Laravel application backup means three things: the project files (including .env), the storage folder with uploaded files, and the database. Here is how to save them all.
1. Manual backup
Archive the code and uploads (excluding vendor and node_modules, which reinstall):
cd /var/www/your-app
tar --exclude=vendor --exclude=node_modules -czf /mnt/backup/app-$(date +%F).tar.gz .
Save the database (MySQL in this example):
mysqldump -u root -p laravel | gzip > /mnt/backup/db-$(date +%F).sql.gz
2. With the spatie/laravel-backup package
The simplest route is the official backup package, which bundles the code and database into a single archive:
composer require spatie/laravel-backup
php artisan backup:run
You configure the destination in config/backup.php, including a disk pointing to your Backup Box.
3. Restore
Unpack the code, restore the database from the dump, run composer install and php artisan migrate if needed.
Keep backups on a Backup Box
Mount a Backup Box as an extra disk and write the archives straight to /mnt/backup, off-server. The address, username and password are on the Backup Box page in your panel.
apt-get install -y cifs-utils
mkdir -p /mnt/backup
mount -t cifs //BACKUP_BOX_ADDRESS/backup /mnt/backup -o username=USER,password=PASSWORD,vers=3.0
Schedule a daily cron that runs the backup and writes to the Backup Box, so your app is always recoverable.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to mount a Backup Box on Windows and share it with users
Mount a Backup Box as a network drive on Windows via SMB and share it with your team: common storage, accessible like a normal disk.
Updated 7/20/2026BackupHow to back up a PostgreSQL database, step by step
A complete PostgreSQL backup guide: pg_dump, cron automation and how to send copies to a Backup Box mounted as an extra disk.
Updated 7/20/2026BackupHow to back up a MongoDB database, step by step
A complete MongoDB backup guide: mongodump, cron automation and how to send copies to a Backup Box mounted as an extra disk.
Updated 7/20/2026