To install an SSL certificate on CentOS, you can use the certbot tool to obtain and install Let’s Encrypt SSL certificates.
Here are the step-by-step instructions.

Install Certbot

sudo yum install epel-release 
sudo yum install certbot python2-certbot-apache

Obtain and Install SSL Certificate

Run Certbot to obtain and install the SSL certificate for your domain:

sudo certbot --apache -d your_domain.com -d www.your_domain.com

Replace your_domain.com with your actual domain name.
Certbot will guide you through the process of obtaining and installing the SSL certificate. It will also configure your Apache server to use the certificate.

Verify the Certificate Installation

After the installation is complete, Certbot will print a message confirming the successful installation and provide instructions on how to verify the installation. It usually involves checking your domain in a web browser to see if it is using HTTPS.

Automatically Renew SSL Certificate

Certbot can automatically renew your SSL certificate before it expires. To enable automatic renewal, you can set up a cron job:

sudo crontab -e

Then add the following line to the crontab file:

0 0 * * * /usr/bin/certbot renew --quiet

This cron job will run every day at midnight to check if your certificate is due for renewal and renew it if necessary.

That’s it! Your SSL certificate is now installed and configured on your CentOS server. Make sure to update your website links to https://, and you’re all set.

Maybe you can’t login wordpress wp-admin due to https redirect.
You can refer to the following article to modify the database to fix the issue.

https://www.weiy.city/2019/07/wordpress-wp-admin-https-redirect-and-install-ssl-certificate/ .

Categories: Web

0 0 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] (2) The second way: Install Let’s Encrypt SSL certificates. The related post: https://www.weiy.city/2024/05/setup-https-on-centos-7/ […]

XOR Strings
: Input your strings, the tool can encrypt and decrypt them.

X
1
0
Would love your thoughts, please comment.x
()
x