Last active
May 14, 2025 08:55
-
-
Save rdp77/29a76ab5038281dd5baf55f3f294784a to your computer and use it in GitHub Desktop.
Laravel Deployment for Linux Server (aaPanel)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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