Pre-Deployment Checklist
Before deploying to production, ensure you have:- Server meeting all system requirements
- Database server installed and accessible
- SSL certificate for your domain
- Backup strategy planned
- Environment variables documented
Server Setup
1. Update System Packages
2. Install Required Software
3. Create Application Directory
Application Installation
1. Clone Repository
2. Install PHP Dependencies
--optimize-autoloader flag generates optimized class maps for better performance, and --no-dev excludes development dependencies.
3. Install Node.js Dependencies and Build Assets
npm ci instead of npm install for faster, more reliable installs in production.
4. Set Up Environment Configuration
.env with production settings:
5. Set Correct Permissions
6. Run Database Migrations
--force flag is required to run migrations in production.
7. Optimize Application
Web Server Configuration
Nginx Configuration
Create/etc/nginx/sites-available/nguhoe:
Apache Configuration
Create/etc/apache2/sites-available/nguhoe.conf:
SSL/TLS Setup with Let’s Encrypt
Queue Worker Setup
Create Supervisor configuration at/etc/supervisor/conf.d/nguhoe-worker.conf:
Performance Optimization
1. Enable OPcache
Edit/etc/php/8.2/fpm/php.ini:
2. Configure Session and Cache
For better performance with multiple servers, consider using Redis:3. Enable HTTP/2
HTTP/2 is enabled by default in the Nginx configuration above. Ensure your SSL configuration includes:Scheduled Tasks (Cron)
Add to crontab for the web user:- Automated backups (configured via spatie/laravel-backup)
- Database cleanup tasks
- Any custom scheduled commands
Post-Deployment Verification
1. Check Application Status
2. Verify Queue Workers
3. Test Application
- Visit https://your-domain.com
- Verify SSL certificate is valid
- Test login functionality
- Check error logs:
tail -f storage/logs/laravel.log
4. Run Health Checks
Deployment Script
Create a deployment script at/var/www/nguhoe/deploy.sh:
Rollback Procedure
If deployment fails:Next Steps
- Set up automated backups
- Configure security settings
- Implement monitoring and logging
- Review maintenance procedures