Created
May 17, 2024 05:40
-
-
Save jhowbhz/f04b37edefcad84636ec3bc7ba566ef5 to your computer and use it in GitHub Desktop.
Permissions security laravel php nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Caminho do projeto Laravel | |
LARAVEL_PATH=/opt/... | |
# Alterar proprietário e grupo | |
sudo chown -R www-data:www-data $LARAVEL_PATH | |
# Permissões para diretórios | |
find $LARAVEL_PATH -type d -exec chmod 755 {} \; | |
# Permissões para arquivos | |
find $LARAVEL_PATH -type f -exec chmod 644 {} \; | |
# Exceções: Diretórios de armazenamento e cache | |
sudo chown -R www-data:www-data $LARAVEL_PATH/storage | |
sudo chown -R www-data:www-data $LARAVEL_PATH/bootstrap/cache | |
sudo chmod -R 775 $LARAVEL_PATH/storage | |
sudo chmod -R 775 $LARAVEL_PATH/bootstrap/cache | |
# Permissoes do .env | |
sudo chown root:www-data $LARAVEL_PATH/.env | |
sudo chmod 640 $LARAVEL_PATH/.env |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment