================================================================================ Configuration Reference Guide ================================================================================ This guide provides detailed information about all configuration options available in your Laravel application. All settings are managed through the .env file in the root directory. ================================================================================ Application Configuration ================================================================================ APP_NAME="Your Application Name" - Used in emails, notifications, and UI - Enclose in quotes if contains spaces - Example: "Rosiya Life Platform" APP_ENV=production - Environment mode: local, production, staging, testing - Controls debug output and error reporting - Production: Hide errors, optimize performance - Local: Show errors, enable debug tools APP_DEBUG=false - Enable/disable debug mode - NEVER set to true in production (security risk!) - Shows detailed error messages and stack traces - Values: true, false APP_KEY=base64:... - Application encryption key (generated automatically) - CRITICAL: Must be set before use - Generate with: php artisan key:generate --show - Keep this SECRET - never commit to version control APP_URL=https://yourdomain.com - Your application's URL - Used for generating links and assets - Include protocol (http:// or https://) - No trailing slash APP_TIMEZONE=UTC - Application timezone for timestamps - See: https://www.php.net/manual/en/timezones.php - Examples: UTC, America/New_York, Europe/London, Asia/Tokyo - Affects all date/time operations APP_LOCALE=en - Default language for the application - Must match a locale file in resources/lang/ - Examples: en, es, fr, de ================================================================================ Database Configuration ================================================================================ DB_CONNECTION=mysql - Database driver to use - Options: mysql, pgsql, sqlite, sqlsrv - cPanel + NGINX stack uses mysql (MySQL 8.0) DB_HOST=localhost - Database server hostname - cPanel default: localhost - For remote databases: Use IP address or hostname - cPanel managed databases always use localhost DB_PORT=3306 - Database server port - MySQL default: 3306 - PostgreSQL default: 5432 - cPanel MySQL uses standard port 3306 DB_DATABASE=username_database_name - Name of your database - IMPORTANT: cPanel adds prefix to database names - Example: If your username is "rosiyali" and DB is "appdb" Then DB_DATABASE=rosiyali_appdb - Must exist before installation - Create in cPanel → Databases → MySQL Database Wizard DB_USERNAME=username_dbuser - Database user with full privileges - IMPORTANT: cPanel adds prefix to usernames - Example: If your username is "rosiyali" and user is "appuser" Then DB_USERNAME=rosiyali_appuser - Create in cPanel → Databases → MySQL Database Wizard - Grant ALL PRIVILEGES to this user DB_PASSWORD=your_password - Database user password - Use strong password (generate in cPanel wizard) - Enclose in quotes if contains special characters - Example: DB_PASSWORD="MyP@ssw0rd!123" Advanced Database Options: DB_CHARSET=utf8mb4 - Character set for database - utf8mb4 supports emojis and special characters DB_COLLATION=utf8mb4_unicode_ci - Collation for sorting and comparison - _ci = case insensitive ================================================================================ Cache Configuration ================================================================================ CACHE_STORE=file - Cache storage driver - Options: * file: Simple file-based cache (default, no setup) * redis: Fast in-memory cache (requires Redis) * memcached: In-memory cache (requires Memcached) * database: Store in database (requires setup) * array: Development only (doesn't persist) CACHE_PREFIX=laravel_cache - Prefix for cache keys - Useful when sharing cache server with other apps - Change if you have multiple Laravel instances REDIS_* (if using Redis): REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 REDIS_CLIENT=phpredis - Redis connection settings - Requires Redis server and PHP Redis extension MEMCACHED_* (if using Memcached): MEMCACHED_HOST=127.0.0.1 MEMCACHED_PORT=11211 - Memcached connection settings - Requires Memcached server and PHP extension ================================================================================ Session Configuration ================================================================================ SESSION_DRIVER=database - Session storage method - Options: * database: Store in database (recommended for production) * file: Store in files (default, simple) * cookie: Store in encrypted cookies * redis: Store in Redis (fast, requires Redis) * memcached: Store in Memcached SESSION_LIFETIME=120 - Session timeout in minutes - After this period of inactivity, user is logged out - 120 = 2 hours - Adjust based on security needs SESSION_ENCRYPT=false - Encrypt session data - true: More secure but slight performance impact - false: Faster, adequate with HTTPS SESSION_PATH=/ - Cookie path - / = entire site - /admin = admin section only SESSION_DOMAIN=null - Cookie domain - null = current domain only - .yourdomain.com = all subdomains ================================================================================ Queue Configuration ================================================================================ QUEUE_CONNECTION=database - Queue driver for background jobs - Options: * sync: No queue, run immediately (development) * database: Store jobs in database * redis: Fast Redis-based queue * beanstalkd: Beanstalkd queue server * sqs: Amazon SQS For database queue, create table with: php artisan queue:table php artisan migrate ================================================================================ Mail Configuration ================================================================================ MAIL_MAILER=smtp - Mail sending method - Options: smtp, sendmail, mailgun, ses, postmark, log, array SMTP Configuration: MAIL_HOST=smtp.mailtrap.io - SMTP server hostname - Examples: * Gmail: smtp.gmail.com * SendGrid: smtp.sendgrid.net * Mailgun: smtp.mailgun.org MAIL_PORT=2525 - SMTP port - Common ports: * 25: Standard (often blocked) * 587: TLS/STARTTLS (recommended) * 465: SSL * 2525: Alternative (Mailtrap, etc.) MAIL_USERNAME=null - SMTP authentication username - Often your email address MAIL_PASSWORD=null - SMTP authentication password - Use app-specific password for Gmail MAIL_ENCRYPTION=tls - Encryption method - Options: tls, ssl, null - TLS recommended (port 587) MAIL_FROM_ADDRESS="noreply@example.com" - Default sender email address - Should be from your domain MAIL_FROM_NAME="${APP_NAME}" - Default sender name - Uses APP_NAME if not specified Third-Party Mail Services: For Mailgun, SendGrid, etc., see their Laravel integration docs ================================================================================ Security Configuration ================================================================================ SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1,yourdomain.com - Domains that can make authenticated API requests - Comma-separated list - Include your domain and all subdomains if needed - Example: app.example.com,api.example.com CORS_ALLOWED_ORIGINS=* - Cross-Origin Resource Sharing settings - * = Allow all origins (development only) - Production: Specify exact domains - Example: https://yourdomain.com,https://app.yourdomain.com DISABLE_INSTALLER=false - Installer access control - false: Installer accessible (during setup) - true: Installer blocked (after installation) - SET TO TRUE after installation for security ================================================================================ Filesystem Configuration ================================================================================ FILESYSTEM_DISK=local - Default storage disk - Options: * local: Local storage/app directory * public: Public storage/app/public (web accessible) * s3: Amazon S3 (requires AWS config) For S3 storage: AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false ================================================================================ Logging Configuration ================================================================================ LOG_CHANNEL=daily - Logging method - Options: * stack: Multiple channels * single: Single file * daily: Daily rotating files * slack: Send to Slack * syslog: System log * errorlog: PHP error log LOG_LEVEL=error - Minimum log level to record - Levels (least to most severe): * debug: Detailed debug information * info: Informational messages * notice: Normal but significant * warning: Warning messages * error: Error messages (recommended for production) * critical: Critical conditions * alert: Action must be taken immediately * emergency: System is unusable LOG_DAILY_DAYS=14 - Days to keep daily log files - Only applies when LOG_CHANNEL=daily - Older files are automatically deleted ================================================================================ Broadcasting Configuration ================================================================================ BROADCAST_CONNECTION=log - Broadcasting driver for real-time events - Options: * log: Log events (development) * pusher: Pusher service * ably: Ably service * redis: Redis pub/sub * null: Disable broadcasting For Pusher: PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_HOST= PUSHER_PORT=443 PUSHER_SCHEME=https PUSHER_APP_CLUSTER=mt1 ================================================================================ Performance Optimization ================================================================================ After changing .env, optimize with: # Cache configuration php artisan config:cache # Cache routes php artisan route:cache # Cache views php artisan view:cache # Clear all caches php artisan optimize:clear For development, disable caching: php artisan config:clear php artisan route:clear php artisan view:clear ================================================================================ cPanel + NGINX Specific Settings ================================================================================ Directory Structure: - Laravel application: /home/USERNAME/laravel_app/ - NGINX document root: /home/USERNAME/laravel_app/public - NGINX logs: /home/USERNAME/logs/ - Configured in: /etc/nginx/conf.d/users/USERNAME/yourdomain.conf PHP 8.3 Settings: - PHP version: Select in cPanel → Select PHP Version - Memory limit: 256M minimum, 512M recommended - Required extensions: Enable in cPanel → Select PHP Version → Extensions - PHP-FPM socket: /opt/cpanel/ea-php83/root/usr/var/run/php-fpm/USERNAME.sock NGINX Configuration: - Config file: /etc/nginx/conf.d/users/USERNAME/yourdomain.conf - Based on: deployment/nginx/cpanel-laravel.conf template - Test config: nginx -t - Reload: systemctl reload nginx - Note: .htaccess files are NOT used with NGINX File Permissions (cPanel): - Application owner: USERNAME:USERNAME (your cPanel username) - Storage directory: chmod 755 storage/ bootstrap/cache/ - NOT www-data (that's for Apache/Debian systems) ================================================================================ Environment-Specific Configs ================================================================================ Development (.env.local): APP_ENV=local APP_DEBUG=true LOG_LEVEL=debug CACHE_STORE=array SESSION_DRIVER=file QUEUE_CONNECTION=sync Production (.env.production): APP_ENV=production APP_DEBUG=false LOG_LEVEL=error CACHE_STORE=redis SESSION_DRIVER=database QUEUE_CONNECTION=redis Staging (.env.staging): APP_ENV=staging APP_DEBUG=false LOG_LEVEL=warning CACHE_STORE=file SESSION_DRIVER=database QUEUE_CONNECTION=database ================================================================================ Configuration Tips ================================================================================ 1. Never commit .env to version control 2. Keep .env.example updated as template 3. Use strong APP_KEY (auto-generated) 4. Set APP_DEBUG=false in production 5. Use database or redis for sessions in production 6. Enable cache in production for performance 7. Configure proper mail settings for notifications 8. Set appropriate timezone for your users 9. Use HTTPS in production (APP_URL with https://) 10. Disable installer after setup (DISABLE_INSTALLER=true) For troubleshooting, see TROUBLESHOOTING.txt For security hardening, see SECURITY.txt