How to Fix “curl: (60) SSL certificate problem”

How to Fix "curl: (60) SSL certificate problem"

One of my customers has a problem with an SSL certificate (HTTPS). The website is normal when accessed using a web browser, HTTPS runs well. But when accessed using the cURL tool, an error arises and fails to connect to the web server.

cURL (client URL) is a tool that functions to transfer data through URLs. cURL is commonly found on Linux / Unix-like operating systems.

cURL or the cURL library are usually used to access the RESTful web service.

Back to the problem, when running the curl command to the website, a error message appears curl: (60) SSL certificate problem: unable to get local issuer certificate.

curl: (60) SSL certificate problem
curl: (60) SSL certificate problem

The error message above explains that curl does not recognize the party that issued the SSL certificate installed in the domain.

Failed to verify server validity and cannot continue connecting to the server for security reasons.

Solution

The solution to the problem above is to merge the .crt file with the ca-bundle file via the cat command.

The file generated from the merge process above is then entered into the web server configuration as an SSL certificate file.

Example of SSL configuration on Nginx web server.

Restart the web server and then try testing access the website again with curl.

curl has successfully accessed a website
curl has successfully accessed a website

If you found this article helpful and would like to support my work, consider making a donation through PayPal. Your support helps me continue creating useful content and tutorials. Thank you!

Donate via PayPal: https://paypal.me/musaamin

Leave a Reply

Your email address will not be published. Required fields are marked *