You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopware6 S3文件系统异常:注释配置仍上传资源至S3

Shopware6 AWS S3配置后assets:install仍上传至S3的问题解决

问题描述

按照Shopware官方文档配置AWS S3作为Shopware6的文件系统,已注释asset配置项,期望bundle文件存储到本地public/bundles目录,但执行bin/console assets:install命令后,文件仍被上传至S3存储桶;注释theme配置项也出现相同问题,清理缓存后情况未改善。

原因分析

  • 默认文件系统 fallback 机制:Shopware6的文件系统配置逻辑中,若未为asset或theme类型单独指定文件系统,会自动 fallback 到default文件系统。如果default配置为S3,即使注释了asset/theme的配置项,系统依然会使用S3来处理这些文件。
  • 缓存残留:常规缓存清理可能未彻底清除容器配置缓存,导致系统仍加载旧的配置规则。

解决方法

  1. 显式指定asset/theme使用本地文件系统
    不要仅注释配置项,需明确将asset和theme的文件系统设置为local,示例配置如下:

    shopware:
      filesystem:
        default: 's3'
        asset: 'local'
        theme: 'local'
        disks:
          local:
            type: 'local'
            config:
              root: '%kernel.project_dir%/public'
          s3:
            type: 's3'
            config:
              bucket: '你的存储桶名称'
              region: '你的区域'
              endpoint: '你的S3端点'
              # 其他S3相关配置参数
    
  2. 彻底清理缓存
    执行以下命令确保所有缓存被清除,使新配置生效:

    bin/console cache:clear --env=prod
    rm -rf var/cache/*
    
  3. 验证配置正确性
    执行命令查看当前文件系统配置,确认asset和theme已正确指向local:

    bin/console debug:config shopware filesystem
    

内容的提问来源于stack exchange,提问作者Michael Koch

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 03:20:00