diff --git a/deploy.sh b/deploy.sh index ec94119..5728b7b 100644 --- a/deploy.sh +++ b/deploy.sh @@ -36,6 +36,18 @@ else exit 1 fi +# 清除并重建配置缓存:改了 config/* 后必须执行,否则 Laravel 仍读旧缓存,修改不生效 +# 注意:若以 root 执行,生成的 bootstrap/cache/config.php 归 root 所有; +# 若 PHP-FPM 以 www 运行,请确保该文件对 www 可读(或部署后统一 chown -R www:www) +log_message "重建配置缓存..." +php artisan config:clear +php artisan config:cache +if [ $? -eq 0 ]; then + log_message "配置缓存已重建" +else + log_message "警告: 配置缓存重建失败(请检查 php 是否在 PATH 中,或 config 含闭包无法缓存)" +fi + # 安装依赖(如果需要) # log_message("安装依赖...") # npm install