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
APP_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
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
composer dump-autoload --optimize
NOTE - NEVER UPDATE IN PRODUCTION. Make sure to keep the backup of
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
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
Create Custom 404 Page In Laravel
Getting Started With AMP (Accelerated Mobile Pages)
Run Raw Queries Securely In Laravel
Make Laravel Controllers Slim By Skimming Form Validation Request
SQLite Doesn't Support Dropping Foreign Keys in Laravel
Relationship Table Data With Route Model Binding In Laravel
Composer Install v/s Composer Update
Laravel Last Executed Query In Plain SQL Statement For Debugging
Basic Server Security Setup For Ubuntu / Linux
composer.json v/s composer.lock