Providers

Providers

Media Manager uses the Local Disk provider by default. You need to install the Flysystem S3 package before you can use Amazon S3 features.

composer require league/flysystem-aws-s3-v3 "^3.0"

After you change Media Manager configuration, you should reset its cache. You can do that with pressing the Refresh button in the Media Manager toolbar.

# Local Disk

By default Media Manager works with the storage/app/media subdirectory of the installation directory. In order to use Amazon S3, you should update the system configuration found in the config/filesystems.php config file and follow the instructions found in this article.

'media' => [
    'driver' => 'local',
    'root' => storage_path('app/media'),
    'url' => '/storage/app/media',
    'visibility' => 'public',
    'throw' => false,
],

# Configuring Amazon S3 access

To use Amazon S3 with October CMS, you need an S3 bucket, a folder in the bucket and an API user. The Storing October CMS Media on Amazon S3 (opens new window) tutorial walks through creating them in the AWS Console.

Open the config/filesystems.php script and find the disks section. It already contains media configuration, you need to change the driver to s3 and replace the API credentials and bucket information parameters:

ParameterValue
driverthe storage driver to use, local or s3.
keythe Access Key ID value of the API user.
secretthe Secret Access Key value of the API user.
bucketyour bucket name.
regionthe bucket region code, for example us-west-2 for US West (Oregon). See the AWS documentation (opens new window) for the code of your bucket region.
urlthe public path of the folder in the bucket.

Example configuration after update:

'disks' => [
    // ...
    'media' => [
        'driver' => 's3',
        'key'    => 'XXXXXXXXXXXXXXXXXXXX',
        'secret' => 'xxxXxXX+XxxxxXXxXxxxxxxXxxXXXXXXXxxxX9Xx',
        'region' => 'us-west-2',
        'bucket' => 'my-bucket',
        'url' => 'https://s3-us-west-2.amazonaws.com/your-bucket-name',
        'visibility' => 'public',
        'throw' => false
    ],
    // ...
]

Save the config/filesystems.php script and congratulations! Now you're ready to use Amazon S3 with October CMS. Note that you can also configure Amazon CloudFront CDN to work with your bucket. This topic is not covered in this document, please refer to CloudFront documentation (opens new window). After you configure CloudFront, you will need to update the url parameter in the filesystems configuration.

# Troubleshooting

The most common issue with using remote services is the SSL connection problem. If you get SSL errors, make sure that your server has fresh SSL certificates of public Certificate Authorities (CA).