Using Spaces with Laravel - cURL Error 60

I am attempting to connect to a Digital Ocean Space from a Laravel 8 webapp using PHP 8. Whenever I try to upload a file, I get this error:


Error executing "PutObject" on 
AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target 
host name '[MY-SPACE-NAME]' 
(see for 

Here is my config file:

'spaces' => [
    'driver' => 's3',
    'key' => env('SPACES_KEY'),
    'secret' => env('SPACES_SECRET'),
    'endpoint' => env('SPACES_ENDPOINT'),
    'region' => env('SPACES_REGION'),
    'bucket' => env('SPACES_BUCKET'),

… and my .env file:


If I add “https://” to the start of the endpoint, it seems to want to prefix the space name before the protocol, ending up with this: [MY-SPACE-NAME]., which obviously throws up another error (cURL error 1).

In the other threads I’ve seen relating to this issue, the suggested solution has been to either uppercase the region (which has no effect in this case) or add ‘https://’ to the endpoint, which doesn’t work either. Prefixing ‘https://’ to the space name yields the correct URL but the same error: cURL error 60. Usually this problem occurs on Windows-users’ local dev environments, so I can’t figure why this is happening in my case (both in my local dev environment on macOS and on a server running Ubuntu.

Some assistance would be most appreciated. Thanks.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 23, 2021
Accepted Answer

Hi there,

I think that I’ve seen a similar problem here:

I believe that the error is occurring as you are not using https:// for your Spaces URL.

So you need to change http://** to https://**

For more information, I would recommend following the steps here on how to integrating an S3-Compatible Object Storage into your Laravel Application:—-integrating-an-s3-compatible-object-storage-into-the-application

Let me know how it goes! Regards, Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel