The error:
depth_zero_self_signed_cert
occurs when a self-signed SSL certificate is used, and Git, curl, or other clients do not trust it. The best solution is to replace the self-signed certificate with a free trusted SSL from Let's Encrypt using Certbot.
sudo apt update
sudo apt install certbot python3-certbot-apache -y
sudo yum install epel-release -y
sudo yum install certbot python3-certbot-apache -y
To automatically configure SSL for Apache:
sudo certbot --apache
For Nginx:
sudo certbot --nginx
After completion, restart your web server:
sudo systemctl restart apache2 # For Apache
sudo systemctl restart nginx # For Nginx
To check if the SSL certificate is active, run:
openssl s_client -connect yourdomain.com:443 -showcerts
If successful, the output should show a valid Let's Encrypt certificate.
Check SSL in the Browser:
Go to https://yourdomain.com > Click on the padlock icon > Verify the SSL is issued by Let's Encrypt.
Let's Encrypt certificates expire every 90 days. To ensure automatic renewal, set up a cron job:
sudo crontab -e
Add the following line:
0 3 * * * certbot renew --quiet
This runs at 3 AM daily to renew SSL when needed.
Test renewal:
sudo certbot renew --dry-run
| Issue | Fix |
|---|---|
| Self-signed certificate error | Install a Let's Encrypt SSL |
| Install Certbot | sudo apt install certbot python3-certbot-apache |
| Issue SSL for Apache | sudo certbot --apache |
| Issue SSL for Nginx | sudo certbot --nginx |
| Set up auto-renewal | sudo crontab -e and add certbot renew --quiet |
Now your server uses a trusted Let's Encrypt SSL certificate!