linux使用lets encrypt设置https证书

 admin   2026-03-10 17:47   6 人阅读  0 条评论

已经安装好apache,mysql和python

1、安装mod_ssl模块

yum -y install mod_ssl

2、安装epel-release

yum -y install epel-release

3、安装snapd,并设置开机启动

yum -y install snapd
systemctl enable --now snapd
sudo snap install core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/local/bin/certbot

4、配置ssl模块和apache虚拟机

vim /etc/httpd/conf/httpd.conf

在配置文件中添加/确认以下行,如果已存在就不用动
LoadModule ssl_module modules/mod_ssl.so

编辑配置文件
[root@aspfj738vhd034j ~]# cat /etc/httpd/conf.d/liuchunjie.top.conf 
<VirtualHost *:80>
    ServerName liuchunjie.top
    ServerAlias www.liuchunjie.top
    DocumentRoot /var/www//html
    
    <Directory /var/www//html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    # CentOS 日志路径不同
    ErrorLog /var/log/httpd/liuchunjie.top_error.log
    CustomLog /var/log/httpd/liuchunjie.top_access.log combined

5、配置证书

certbot --apache -d liuchunjie.top -d www.liuchunjie.top
本文地址:https://www.liuchunjie.top/?id=816
版权声明:本文为原创文章,版权归 admin 所有,欢迎分享本文,转载请保留出处!
NEXT:已经是最新一篇了

评论已关闭!