Skip to content

Instantly share code, notes, and snippets.

@rdp77
Last active May 14, 2025 08:55
Show Gist options
  • Save rdp77/29a76ab5038281dd5baf55f3f294784a to your computer and use it in GitHub Desktop.
Save rdp77/29a76ab5038281dd5baf55f3f294784a to your computer and use it in GitHub Desktop.
Laravel Deployment for Linux Server (aaPanel)
# Go to project directory
cd /www/wwwroot/website
# Fetch latest changes from remote
git fetch origin
# Forcefully reset local files to match the remote main branch
git reset --hard origin/main
# Install production dependencies only
composer install --no-dev --optimize-autoloader
# Clear and cache Laravel configuration
php artisan config:clear
php artisan config:cache
# Create symbolic link for storage (public storage directory)
php artisan storage:link
# Run any new database migrations
php artisan migrate --force
# Fix file permissions so the web server (www) owns everything
# chown -R www:www .
chown -R www:www . 2>/dev/null
# (Optional) Set correct permissions if needed
# find storage -type d -exec chmod 775 {} \;
# find storage -type f -exec chmod 664 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment