Une configuration correcte des permissions est essentielle pour la sécurité et le fonctionnement d’une application Laravel.
Propriétaire des fichiers
Si le serveur web utilise www-data.
sudo chown -R www-data:www-data /path/to/laravel
Permissions fichiers et dossiers
sudo find /path/to/laravel -type f -exec chmod 644 {} \;sudo find /path/to/laravel -type d -exec chmod 755 {} \;Dossiers Laravel
Donnez les droits d’écriture au serveur web.
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Ajoutez votre utilisateur au groupe www-data pour gérer les fichiers via SFTP.
sudo usermod -a -G www-data ubuntu