54 lines
1.3 KiB
Bash
Executable File
54 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "🔧 Fixing file permissions and ownership for Docker development..."
|
|
|
|
# Stop containers first
|
|
echo "🛑 Stopping containers..."
|
|
docker-compose down
|
|
|
|
# Fix ownership - change back to current user for development
|
|
echo "👤 Fixing file ownership..."
|
|
sudo chown -R $USER:$USER .
|
|
|
|
# Set proper permissions for Laravel
|
|
echo "🔐 Setting Laravel permissions..."
|
|
chmod -R 755 .
|
|
chmod -R 775 storage bootstrap/cache
|
|
chmod 644 .env
|
|
|
|
# Ensure public directory is readable
|
|
chmod -R 755 public
|
|
|
|
# Fix specific file permissions
|
|
chmod 644 public/index.php
|
|
chmod 644 artisan
|
|
chmod +x artisan
|
|
|
|
echo "📋 Current ownership:"
|
|
ls -la public/index.php
|
|
ls -la .env
|
|
|
|
# Restart containers
|
|
echo "🚀 Starting containers..."
|
|
docker-compose up -d
|
|
|
|
# Wait for containers to be ready
|
|
echo "⏳ Waiting for containers..."
|
|
sleep 10
|
|
|
|
# Test inside container
|
|
echo "🧪 Testing file access in container..."
|
|
docker exec ckb-app-dev ls -la /var/www/html/public/index.php
|
|
|
|
# Test HTTP access
|
|
echo "🌐 Testing HTTP access..."
|
|
sleep 5
|
|
curl -I http://localhost:8000
|
|
|
|
echo ""
|
|
echo "✅ Permission fix completed!"
|
|
echo ""
|
|
echo "If still having issues, try:"
|
|
echo "1. Check container logs: docker logs ckb-app-dev"
|
|
echo "2. Test PHP directly: docker exec ckb-app-dev php /var/www/html/public/index.php"
|
|
echo "3. Check nginx config: docker exec ckb-app-dev nginx -t" |