Zum Hauptinhalt springen

File Permissions & Storage

Proper file permissions are critical for both security and functionality.


Required Permissionsโ€‹

PathPermissionOwnerZweck
Project root (/var/www/feedbackpulse-saas/)755www-dataApplication files
storage/775www-dataLogs, cache, sessions, uploads
storage/app/public/775www-dataPublic uploads (logos, photos)
storage/framework/cache/775www-dataApplication cache
storage/framework/sessions/775www-dataUser sessions
storage/framework/views/775www-dataCompiled Blade views
storage/logs/775www-dataApplication logs
bootstrap/cache/775www-dataFramework bootstrap cache
.env640www-dataSensitive configuration

Set Permissions (Linux)โ€‹

cd /var/www/feedbackpulse-saas

# Set ownership
sudo chown -R www-data:www-data .

# Files: 644, Directories: 755
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;

# Writable directories
sudo chmod -R 775 storage bootstrap/cache

# Protect .env file
sudo chmod 640 .env

Replace www-data with your web server's user:

  • Apache on Ubuntu: www-data
  • Nginx on Ubuntu: www-data
  • Apache on CentOS: apache
  • Nginx on CentOS: nginx
  • Laragon on Windows: No permission changes needed

Laravel uses a symbolic link to make files in storage/app/public/ accessible via the web:

public/storage -> storage/app/public/

Create Itโ€‹

php artisan storage:link

Verify Itโ€‹

ls -la public/storage
# Should show: public/storage -> /var/www/feedbackpulse-saas/storage/app/public

What It Storesโ€‹

DirectoryContent
storage/app/public/logos/Tenant company logos
storage/app/public/products/Product images
storage/app/public/submissions/Uploaded photos from feedback
storage/app/public/avatars/User profile pictures
storage/app/public/landing/Landing page assets

Disk Space Managementโ€‹

Monitor Disk Usageโ€‹

# Check overall disk usage
df -h

# Check FeedbackPulse storage usage
du -sh storage/app/public/
du -sh storage/logs/
du -sh storage/framework/cache/

Log Rotationโ€‹

Laravel logs can grow large. Set up log rotation:

sudo nano /etc/logrotate.d/feedbackpulse
/var/www/feedbackpulse-saas/storage/logs/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
copytruncate
}

Clear Cacheโ€‹

cd /var/www/feedbackpulse-saas

# Clear application cache
php artisan cache:clear

# Clear compiled views
php artisan view:clear

# Clear route cache
php artisan route:clear

# Clear config cache
php artisan config:clear

# All at once
php artisan optimize:clear

Naechste Schritteโ€‹