File Permissions & Storage
Proper file permissions are critical for both security and functionality.
Required Permissions
| Path | Permission | Owner | Objectif |
|---|---|---|---|
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