Kritim Yantra
Apr 24, 2025
Laravel is one of the most powerful PHP frameworks, and Laravel 12 brings some exciting features and improvements. But building your Laravel application is only half the journey. The next step is getting it live so the world can use it!
In this blog, we’ll walk through step-by-step how to deploy your Laravel 12 application from your local development environment to a live production server. This guide is designed for beginners, so even if you’ve never deployed a Laravel app before, you’ll be able to follow along.
Before jumping in, make sure you have:
Make sure your app is fully functional on your local system.
✅ Use .env
for local config
✅ Run php artisan serve
to test
✅ Check that your database, routes, and views work
✅ Run php artisan migrate
and php artisan db:seed
to test migrations and dummy data
Laravel uses environment-specific settings, so let’s prepare:
APP_ENV
to productionIn your .env
file (on the server), set:
APP_ENV=production
APP_DEBUG=false
You can either:
public
folder as your root directory/public
to root or configure .htaccess
Recommended for better performance and control.
/var/www/laravel-app
)sudo chown -R www-data:www-data /var/www/laravel-app
sudo chmod -R 755 /var/www/laravel-app
Make sure the storage
and bootstrap/cache
folders are writable:
sudo chmod -R 775 storage
sudo chmod -R 775 bootstrap/cache
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/laravel-app/public
<Directory /var/www/laravel-app/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Enable .htaccess
if using Apache.
Run the following commands inside your app directory:
composer install
php artisan key:generate
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
--force
will skip the confirmation prompts, useful for production.
.env
is correctly configured with your production database, mail, and other credentials..env
file. Create a new one on the server and configure it properly.For security:
.env.example
, .git
, and any test routesstorage/logs
If using a VPS:
sudo apt install certbot python3-certbot-apache
sudo certbot --apache
Visit your domain, and your Laravel 12 app should now be online!
sudo apt install supervisor
php artisan config:cache
php artisan route:cache
Set up daily backups of your database
Monitor logs with tools like Laravel Telescope or external services
Deploying Laravel 12 may sound overwhelming at first, but once you understand the steps, it becomes a repeatable and smooth process. Whether you’re using shared hosting or a full-blown VPS, this guide gives you the essential building blocks to get your app from local to live.
Keep experimenting, keep deploying, and soon this process will feel second nature.
No comments yet. Be the first to comment!
Please log in to post a comment:
Sign in with Google