Deploy Laravel Backend - Gianguyen1234/app-doc GitHub Wiki
you need to deploy the Frontend (React Native app) and Backend (Laravel API) separately since they serve different purposes. Here’s how you can do it:
1️⃣ Deploy Laravel Backend (API)
You need to host your Laravel API on a server so your React Native app can communicate with it.
✅ Options for Deploying Laravel Backend
- VPS (Recommended for full control): DigitalOcean, Linode, AWS EC2, Vultr.
- Cloud Services: AWS, Google Cloud, Azure.
✅ Steps to Deploy Laravel API
- Get a server (VPS or Cloud).
- Install LAMP/LEMP stack (Linux, Apache/Nginx, MySQL, PHP).
- Upload Laravel project (via Git, SCP, or FTP).
- Configure
.env
file (set database, APP_URL, etc.). - Run migrations & seeders:
php artisan migrate --seed
- Set permissions:
chmod -R 775 storage bootstrap/cache
- Set up a web server (Apache).
- Use Supervisor (for queue jobs if needed).
- Setup SSL (HTTPS) with Let's Encrypt.
✅ API Hosting Suggestions
- Database: MySQL
- Storage: AWS S3 (for images/files).
- Authentication: Laravel Sanctum for mobile API tokens.