繁体   English   中英

如何在 Magento 2 上配置远程存储以使用本地 S3 存储

[英]How to configure remote-storage on Magento 2 to use local S3 storage

我正在尝试将 Magento 2 远程存储连接到我的本地 S3 存储。

s3cmd 配置为连接https://s3.example.com正常工作,可以创建存储桶,发送文件等。

Magento 2 已构建 aws-s3 驱动程序但无法设置正确的参数。 我尝试设置类似这样的设置,但仍然无法正常工作并且 S3Client 仅连接到预定义的端点(按区域)

'remote_storage' => [
                    'driver' => 'aws-s3',
                    'config' => [
                            'endpoint' => 's3.example.com',
                            'bucket' => 'magento',
                            'bucket_endpoint' => true,
                            'region' => 'eu-west-2',
                            'use_path_style_endpoint' => true,
                            'credentials' => [
                                    'key' => 'C****************C',
                                    'secret' => 'R****************2',
                            ],
                            'debug' => true

                    ]

    ],

可以使用内置 s3 驱动程序连接私有 s3 堆栈吗?

在尝试为本地测试实施 LocalStack 时,我也遇到了这个问题。 我已经放弃了 Magento 的 S3 实现不支持这个的想法,但我又看了你的例子。

编辑:我现在使用我的 LocalStack 端点在我的本地工作。 我希望相同的配置适用于您的自定义端点。 bucket_endpoint配置尤其让我感到惊讶,但如果没有这个配置,文件上传就会因路径无效而失败。

            'bucket' => 'test-local-s3',
            'bucket_endpoint' => false,
            'region' => 'east-1',
            'scheme' => 'http',
            'endpoint' => 'http://localstack:4566',
            'use_path_style_endpoint' => true,
            'credentials' => [
                'key' => 'C****************C',
                'secret' => 'R****************2',
            ],
            'debug' => true,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM