File Permissions & Storage
Proper file permissions are critical for both security and functionality.
Required Permissionsโ
| Path | Permission | Owner | Zweck |
|---|---|---|---|
Project root (/var/www/feedbackpulse-saas/) | 755 | www-data | Application files |
storage/ | 775 | www-data | Logs, cache, sessions, uploads |
storage/app/public/ | 775 | www-data | Public uploads (logos, photos) |
storage/framework/cache/ | 775 | www-data | Application cache |
storage/framework/sessions/ | 775 | www-data | User sessions |
storage/framework/views/ | 775 | www-data | Compiled Blade views |
storage/logs/ | 775 | www-data | Application logs |
bootstrap/cache/ | 775 | www-data | Framework bootstrap cache |
.env | 640 | www-data | Sensitive 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-datawith 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
The Storage Symlinkโ
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โ
| Directory | Content |
|---|---|
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