Good content takes time and effort to come up with.
Please consider supporting us by just disabling your AD BLOCKER and reloading this page again.
Most of the time you forget to do a few changes after Laravel Production deployment. I have tried my best to cover them through this article.
Hope you guys might have deployed your application in AWS / Digital Ocean / Linode / Google Cloud or similar services. If not you can check the following articles
.env
fileAPP_NAME='Your Product Name'
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_username
DB_PASSWORD=database_password
BROADCAST_DRIVER=pusher
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120
Without any dev
dependencies - This will boost the speed and won't install unnecessary development packages
composer install --optimize-autoloader --no-dev
With dev dependencies - Usually for the final check of how your dev
dependencies are performing. Usually in testing
servers.
composer dump-autoload --optimize
NOTE - NEVER UPDATE IN PRODUCTION. Make sure to keep the backup of composer.json
& composer.lock
files. Unless you want the minor versions of your project to be update make sure not to update the composer packages.
composer update --optimize-autoloader
#Application Cache
php artisan config:cache
#Optimizing Route Loading
php artisan route:cache
#Compile and cache Blade templates
php artisan view:cache
#Events cache
php artisan event:cache
Instead of running all the cache commands one by one you can make a custom cache command and run it once. I have written an article on the same - Laravel Custom Command To Cache Your Applications
You can cache your Static assets too using - Cache Static File Using NGINX
npm run production
OR
Make sure to protect your assets like CSS / Js / Images from others accessing from their website - Cache Static Files With NGINX
* * * * * cd /project_path && php artisan schedule:run >> /dev/null 2>&1
You can learn more on - Laravel Cronjobs Usage & Settings
Automate Repeating Tasks In Linux Server With Cronjobs
If you are using Supervisor for running your Queue Scheduling the don't forget to set up from here - Supervisor For Laravel Queue Scheduling
php artisan storage:link
You can read more on installing SSL certificates in CPanel or VPS servers with the following articles
If you have set up your server with SSH key access then don't use PHPMyAdmin or any other browser-based clients in your server.
Use SSH Key database login with Sequel Ace or MySQL Workbench kind of client which supports SSH key login to your database.
Securely Connect Server MYSQL DB From Sequel Pro / MYSQL Workbench
Firebase Cloud Messaging (FCM) Browser Web Push Notifications Using Javascript And PHP
Why namespace And use Keywords Used In PHP
Automate Repeating Tasks In Linux Server With Cronjobs
Simple Way To Create Resourceful API Controller In Laravel
Multiple GIT Key Pairs Or Account In The Same Computer
Custom Validation Rules In PHP Laravel (Using Artisan Command)
Global Data In All Laravel Blade Pages
Free Live Chat Integration Using TAWK.IO
Dependency Dropdowns With Javascript And PHP
Testing Laravel Emails With MailHog
Stripe Payment Integration With Laravel