I have tried those steps on a Ubuntu 20.04 Server, with Openlitespeed
And the issue i was facing is that a commercial SSL was expiring and i wanted to replace it with a Let’sencrypt free SSL , but the installation of the Letsencrypt SSL was not successful as the old commercial ssl was not removed y any mean. so following the steps below solved the issue.
Step 1: Delete the Invalid Renewal Configuration
- Remove the problematic renewal configuration file:
sudo certbot certificates
Look for the entry for yourdomain.com
and confirm its expiration date.
Step 2: Reissue the Certificate
If the existing certificate is valid but needs to be reissued (e.g., because of a misconfiguration), you can force Certbot to reissue it:
- Use the
--force-renewal
flag:
sudo certbot certonly --force-renewal --standalone -d yourdomain.com -d www.yourdomain.com
This will overwrite the existing certificate.
Step 3: Delete and Recreate the Certificate
If the existing certificate is invalid or causing issues, you can delete it and then request a new one.
Delete the existing certificate:
sudo certbot delete --cert-name yourdomain.com
2. Request a new certificate:
sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
Step 4: Verify Port Availability
Certbot’s --standalone
mode uses port 80 to validate your domain. Ensure that no other service (like LiteSpeed or Apache) is occupying port 80 during this process:
Stop LiteSpeed:
sudo systemctl stop lsws
2. Run Certbot again to request the certificate:
sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com
3. Restart LiteSpeed after obtaining the certificate:
sudo systemctl start lsws
Step 5: Check Logs for Details
If the issue persists, inspect the log file for more specific errors:
sudo cat /var/log/letsencrypt/letsencrypt.log
The log will provide additional context to troubleshoot the issue.
Step 6: Apply the Certificate in LiteSpeed
Once the certificate is successfully obtained, update your LiteSpeed virtual host configuration to point to the new certificate and private key files:
- Certificate:
/etc/letsencrypt/live/yourdomain.com/fullchain.pem
- Key:
/etc/letsencrypt/live/yourdomain.com/privkey.pem
Restart LiteSpeed to apply the changes:
- Certificate:
sudo systemctl restart lsws