我使用Flysystem模块与flysystem_dropbox和flysystem_s3存储。我已经按照模块的readme.txt文件中的描述在settings.php中配置了方案。
现在,当我同步文件从本地到dropbox或本地到s3的同步过程是正常工作的,但如果我试图存储文件直接从一个节点添加表单到dropbox或s3它不工作。我在最近的日志消息中得到以下错误链接
Dropbox error:
上传目录dropboxexample://对于文件字段,field_dropbox_file不能被创建或没有被创建可访问。新上传的文件无法保存在此目录中结果,上传被取消了。
S3错误:
S3 Aws 例外 S3Exception:错误执行"PutObject"在"https://s3 -欧盟-西方- 1. - amazonaws.com/drupal8test/&";AWS HTTP错误:客户端错误响应[url]https://s3-eu-west-1.amazonaws.com/drupal8test/[状态码]400错误的请求IllegalLocationConstraintException(client):未指定的位置约束不兼容此请求被发送到的特定于区域的端点。- & lt; ?xmlversion ="1.0";编码="UTF-8"?比;& lt; Error> & lt; Code>IllegalLocationConstraintException & lt; Message>未指定的位置约束与该区域不兼容发送此请求的特定端点灵活;/Message> & lt; RequestId>A0EFF7B64110C2C5 & lt; HostId> hze5fRf4JLZYsWLrlT5djroRwL/LrxWgzFX9qU5tP + riDfBeYNn900z36HtwktejaqckD2Gwhss = & lt;/HostId> & lt;/Error>in AwsWrappedHttpHandler->parseError(/var/www/html/drupal8/core/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php).
方案配置如下:
$schemes = [
'dropboxexample' => [
'driver' => 'dropbox',
'config' => [
'token' => '[my-token]',
'client_id' => '[my login email id]',
],
],
's3example' => [
'type' => 's3',
'driver' => 's3',
'config' => [
'key' => '[my-access-key]',
'secret' => '[my-secret-key]',
'region' => 'eu-west-1',
'bucket' => '[bucket-name]',
'cname' => '[bucket-url]',
],
],
'localexample' => [
'driver' => 'local',
'config' => [
'root' => '/var/www/html/drupal8/sites/default/files',
],
'cache' => FALSE,
'replicate' => 'dropboxexample',
'serve_js' => TRUE,
'serve_css' => TRUE,
]
];
$settings['flysystem'] = $schemes;
所以谁能告诉我,如果我错过了一些配置设置或其他东西?
我有同样的问题,似乎是你的AWS策略,你需要审查S3策略,然后使用模拟器来检查它至少在亚马逊S3上工作。我也开了一张关于这个问题的票,如果你想遵循
Drupal问题https://www.drupal.org/node/2666260
你的问题是区域,它需要像
一样设置//|Region name |Region id |
//|:-------------------------|:--------------|
// |US East (N. Virginia) |us-east-1 |
// |US West (N. California) |us-west-1 |
// |US West (Oregon) |us-west-2 |
// |EU (Ireland) |eu-west-1 |
// |EU (Frankfurt) |eu-central-1 |
// |Asia Pacific (Tokyo) |ap-northeast-1 |
// |Asia Pacific (Seoul) |ap-northeast-2 |
// |Asia Pacific (Singapore) |ap-southeast-1 |
// |Asia Pacific (Sydney) |ap-southeast-2 |
// |South America (Sao Paulo) |sa-east-1 |
$schemes = [
's3' => [
'driver' => 's3',
'config' => [
'key' => '[your key]',
'secret' => '[your secret]',
'region' => '[aws-region-id]',
'bucket' => '[bucket-name]',
// Optional configuration settings.
'options' => [
'ACL' => 'public-read',
'StorageClass' => 'REDUCED_REDUNDANCY',
],
'protocol' => 'https', // Will be autodetected based on the current request.
'prefix' => 'an/optional/prefix', // Directory prefix for all uploaded/viewed files.
'cname' => 'static.example.com', // A cname that resolves to your bucket. Used for URL generation.
],
'cache' => TRUE, // Creates a metadata cache to speed up lookups.
),
);$settings['flysystem'] = $schemes;