fix permission on local using root
This commit is contained in:
54
fix-permissions.sh
Executable file
54
fix-permissions.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user