Environment Configuration
Critical Settings
Generate Application Key
Ensure your application key is set:
This key is used for encrypting sessions, cookies, and other sensitive data.
Database Configuration
MySQL Configuration
MySQL Configuration
Switch from SQLite to MySQL for production:
Use a strong, unique password for database access
Run Migrations
Run Migrations
Execute database migrations:The
--force flag is required in production environments.Seed Initial Data
Seed Initial Data
Create the admin user and initial data:
Mail Server Configuration
SMTP Settings
Configure your production mail server:
Test Email Delivery
Verify email notifications are working:
Performance Optimization
Caching Strategy
Optimize Composer Autoloader
Generate optimized autoload files:The
--no-dev flag excludes development dependencies.Database Caching
Configure cache to use database for better performance:Security Hardening
SSL/HTTPS Configuration
SSL/HTTPS Configuration
Ensure your application is served over HTTPS:
- Obtain an SSL certificate (Let’s Encrypt recommended)
- Configure your web server to redirect HTTP to HTTPS
- Update
APP_URLto usehttps://
Verify SSL is working: https://www.ssllabs.com/ssltest/
Environment Variables Security
Environment Variables Security
Protect your Ensure
.env file:.env is in .gitignore and never committed to version control.Directory Permissions
Directory Permissions
Set correct permissions:
Security Headers
Security Headers
Configure security headers in your web server:
X-Frame-Options: SAMEORIGINX-Content-Type-Options: nosniffX-XSS-Protection: 1; mode=blockStrict-Transport-Security: max-age=31536000
Queue Workers
Configure queue connection:Scheduled Tasks
NutriFit sends appointment reminders 24 hours in advance. Configure the Laravel scheduler:Backup Strategy
Final Verification
- Checklist
- Testing
Before going live, verify:
-
APP_ENV=productionis set -
APP_DEBUG=falseis set - Database is MySQL (not SQLite)
- SMTP server is configured
- Assets are compiled (
npm run build) - Composer is optimized (
--no-dev) - All caches are generated
- Queue worker is running
- Cron job is configured
- SSL certificate is installed
- Backups are configured
- Admin account is created
- Test email notifications work
- Test appointment booking works
- Test PDF generation works
Rollback Plan
Before deployment, prepare a rollback strategy:- Keep previous version files accessible
- Have database backup ready to restore
- Document rollback commands
- Test rollback procedure in staging
Consider using a staging environment to test deployment procedures before production.
Next Steps
Environment Setup
Detailed production environment configuration
Deployment Platforms
Choose and configure your hosting platform
Queue Workers
Set up background job processing
Monitoring
Monitor your production application