Skip to content

Instantly share code, notes, and snippets.

@rolandstarke
rolandstarke / Nginx FastCGI Cache.md
Last active September 7, 2024 17:47
Serve Laravel from the Nginx cache

Nginx FastCGI Cache with Laravel

Serve dynamicaly generated files from Laravel from the Nginx cache.

Nginx config

docs

# sudo nano /etc/nginx/sites-available/default
@rolandstarke
rolandstarke / README.md
Last active September 7, 2024 17:47
Faster Laravel File Cache Garbage Collector

Laravel File Cache Garbage Collector

Command to delete old expired cache files.

When using the file cache driver, Laravel creates the cache files but never purges expired ones. This can lead to a situation where you have a large number of unused and irrelevant cache files, especially if you do a lot of short-term caching in your system.

Install

@rolandstarke
rolandstarke / README.md
Last active September 7, 2024 17:48
Laravel less cookies in response

Laravel less Cookies in Response

Laravel sends the session and csrf cookie in every response. That is additional trafic that's not needed. With this changes the session cookie and csrf cookie don't get resend to the client every time if they did not change (but at least once an hour to prevent client side expiring).

@rolandstarke
rolandstarke / laravel setup.sh
Last active October 9, 2024 17:20
Server setup bash script for Laravel
# Ubuntu 20 LTS Server Setup for Laravel
# Login as root user
sudo su -
# Update list of available packages
apt update