diff --git a/deploy.sh b/deploy.sh index c96e8b5..2871ec1 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,4 +1,13 @@ #!/bin/bash +### + # @Author: lucan + # @Date: 2026-08-08 21:59:00 + # @LastEditors: lucan + # @LastEditTime: 2026-08-08 22:59:39 + # @FilePath: \MES\deploy.sh + # @Description: + # @Copyright: Copyright (c) {year} lucan. All rights reserved. +### # 部署脚本 # 路径: /www/wwwroot/mes2/deploy.sh @@ -36,6 +45,17 @@ 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 @@ -77,4 +97,4 @@ fi # fi log_message "部署完成!" -exit 0 \ No newline at end of file +exit 0