Skip to main content

Posts

Showing posts with the label Laravel Deployment

How to Use Laravel with Subdomains on cPanel

How to Use Laravel with Subdomains on cPanel Laravel supports subdomain routing out of the box, but configuring it on cPanel can be confusing for new developers. Whether you're building a multi-tenant app or organizing admin panels, here's how to properly set up subdomains with Laravel on shared hosting. 🛠️ Prerequisites Laravel project deployed on a cPanel-hosted domain Access to the Subdomains section in cPanel Basic knowledge of Laravel routing 🌐 Step 1: Create Subdomains in cPanel Log in to your cPanel account. Go to Subdomains under the Domains section. Create a subdomain like admin.example.com . Point the document root to your Laravel project’s public/ directory. For example: /home/your-user/your-laravel-project/public Repeat for each subdomain (e.g. user.example.com ). 🧭 Step 2: Define Subdomain Routes in Laravel In your Larav...

Laravel Queue Setup on Shared Hosting

Laravel Queue Setup on Shared Hosting Laravel queues allow you to defer time-consuming tasks like sending emails or processing uploads. But on shared hosting, there’s no supervisor tool like on VPS. Don’t worry — with cPanel and cron, you can still run queues efficiently. 🛠️ Prerequisites Laravel project already deployed on shared hosting (via cPanel) Queueable jobs created using php artisan make:job Basic understanding of Laravel's queue system ⚙️ Step 1: Configure Your Laravel Queue By default, Laravel uses the sync driver, which runs jobs immediately. Update the driver to database (or Redis, if supported): QUEUE_CONNECTION=database In your .env file, set the queue driver. If using database , run: php artisan queue:table && php artisan migrate This creates the necessary table for storing queued jobs. 📍 Step 2: Locate the Laravel Project Path Find your full La...

How to Schedule Cron Jobs in Laravel on cPanel

How to Schedule Cron Jobs in Laravel on cPanel Laravel's task scheduler makes it easy to automate repetitive tasks like sending emails or cleaning up logs. On shared hosting with cPanel , you can trigger Laravel's scheduler using cron jobs. In this post, I’ll guide you through setting it up step by step. 🛠️ Prerequisites Laravel project already deployed on cPanel Access to cPanel's Cron Jobs section Basic knowledge of Laravel commands 📄 Step 1: Create Your Laravel Scheduled Tasks Define your scheduled tasks inside the app/Console/Kernel.php file under the schedule() method: protected function schedule(Schedule $schedule) { $schedule->command('emails:send')->daily(); $schedule->command('backup:run')->weekly(); } You can schedule Artisan commands, closures, queue jobs, and more. 📍 Step 2: Locate the Laravel Project Path Find the absolute...