🚀 How to Back Up Laravel Projects or Apps on VPS or EC2 for Free (with LaraSafe)

Learn how to back up your Laravel projects on VPS or EC2 for free using LaraSafe. Automate, schedule, and secure your Laravel backups easily.
Laravel backup, Laravel backup tool, Laravel backup VPS, Laravel backup EC2, free Laravel backup, LaraSafe, Laravel project backup script, Laravel database backup, backup Laravel site, EC2 Laravel automation

If you’ve ever lost your Laravel project data due to a VPS crash or a small mistake in deployment, you know how painful it feels. Whether you host on AWS EC2, DigitalOcean, or any other VPS, having a proper backup strategy is not optional — it’s essential.

In this post, I’ll show you how to automate backups of your Laravel apps on VPS or EC2 — completely free using an open-source tool I built called LaraSafe.


💡 Why You Need Laravel Backups

Laravel is powerful — but your server isn’t bulletproof. Common issues like:

  • Server crashes
  • Wrong deployment commands
  • Database corruption
  • Mistakenly deleted files
  • Security breaches

…can take your entire project down in seconds.

Having regular automated backups means you can restore your app with a single upload — instead of crying over lost work or client data.


🧠 What You Should Back Up in Laravel

Before we jump into tools, it’s important to know what actually needs to be backed up.
For a typical Laravel app, include:

✅ The Laravel project files (app, config, routes, public, etc.)
✅ The .env file (for environment variables)
✅ The database (MySQL, PostgreSQL, etc.)
✅ User uploads (storage/app/public)

These together make your app restorable anytime, anywhere.


⚙️ Meet LaraSafe — A Free Laravel Backup Manager

I created LaraSafe to simplify backups for developers like us.
Instead of writing bash scripts or manually compressing folders, LaraSafe gives you a beautiful dashboard to manage all your Laravel project backups in one place. (PS: Now you can backup any projects using LaraSafe)

🔑 Key Features:

  • 📦 One-click backup for Laravel projects
  • ⏰ Automated daily, weekly, or monthly scheduling
  • 🔒 SHA-256 integrity verification (detects corruption)
  • 🧹 Auto cleanup of old backups
  • 📊 Clean dashboard built with Vue + Inertia
  • 💾 Works even on free VPS or EC2 tiers

All you need is a PHP server — no paid services required.


🧩 How to Set Up Backups on VPS or EC2

Let’s walk through the setup.

1️⃣ Clone and Install LaraSafe

git clone https://github.com/sudhirrajai/LaraSafe.git
cd LaraSafe
composer install
npm install && npm run build
cp .env.example .env
php artisan key:generate

Then, open .env and set up your database connection.

Run migrations:

php artisan migrate --seed

Now you can access the LaraSafe dashboard in your browser.


2️⃣ Add Your Laravel Project

Go to your LaraSafe panel → click “Add Project” → give it:

  • A project name (e.g., MyPortfolioApp)
  • The path to your Laravel app (e.g., /var/www/myapp)
  • Backup schedule (daily, weekly, or monthly)

LaraSafe will automatically zip your files and create a backup inside its private storage folder.


3️⃣ Set Up the Cron Job

For automation, add this line to your VPS or EC2 cron jobs:

* * * * * cd /var/www/LaraSafe && php artisan schedule:run >> /dev/null 2>&1

This runs Laravel’s scheduler every minute and triggers LaraSafe’s jobs as per your settings.


4️⃣ Store Backups Safely

By default, LaraSafe stores your backups in:

storage/app/private

You can:

  • Move this folder to a mounted external volume
  • Sync it to Google Drive, Dropbox, or Amazon S3 Free Tier
  • Or even push it to another VPS using rsync

This ensures your data stays safe even if your main server goes down.


5️⃣ Verify and Restore Anytime

Each backup LaraSafe creates comes with a checksum — meaning it detects if the backup ever gets corrupted.

To restore, simply unzip your backup, place your project files back, import the SQL dump, and you’re live again.


🧰 Manual Alternative (If You Prefer Scripts)

If you don’t want to use LaraSafe, here’s a quick manual backup method for free:

# Backup database
mysqldump -u root -p mydatabase > /backups/db_$(date +%F).sql

# Backup Laravel files
tar -czf /backups/app_$(date +%F).tar.gz /var/www/my-laravel-app

# Combine into single file
tar -czf /backups/backup_$(date +%F).tar.gz /backups/db_$(date +%F).sql /backups/app_$(date +%F).tar.gz

# Auto delete old backups (14 days)
find /backups -type f -mtime +14 -delete

Then, schedule it in cron — and you’re good to go!


🔒 Backup Best Practices

Follow these golden rules to keep your Laravel projects safe:

✅ Don’t store backups on the same disk as your app
✅ Encrypt or protect sensitive files
✅ Monitor disk usage
✅ Keep multiple restore points
✅ Test restoring at least once a month


🏁 Final Thoughts

Backing up your Laravel project doesn’t need to be complicated or expensive.
With tools like LaraSafe, you can automate, verify, and manage backups for free on any VPS or EC2 instance.

💬 “A good backup system isn’t about preventing failure — it’s about recovering fast when it happens.”

So take 10 minutes today, set up LaraSafe, and sleep peacefully knowing your Laravel apps are always safe.

Previous Article

LaraSafe – Laravel 12 Backup & Restore Dashboard with Inertia and Vue

Write a Comment

Leave a Comment

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