centos7 xampp 配置Let's Encrypt 证书

Fork Me On Github

centos7 xampp 配置Let's Encrypt 证书

本次使用的是 Let's Encrypt 推荐的快速安装工具 Certbot

尝试

一开始使用文档中的安装方法

yum install certbot-apache

但是发现报错,原来是程序不是最新的

然后根据 certbot: ImportError: ‘pyOpenSSL’ module missing required functionality, 使用pip 安装

清除之前操作

yum remove certbot pyOpenSSL

准备

安装epel扩展源, 安装pip并更新到最新

yum -y install epel-release

yum -y install python-pip

pip install --upgrade pip

安装

安装最新版

pip install pyOpenSSL

pip install certbot

申请ssl 绑定路径

certbot certonly --webroot -w /data/www/html -d zodream.cn

如果有多个域名

那么只要在加上 -d 域名即可,即使是临时增加一个域名,也要把所有域名都加上才行,

certbot certonly --webroot -w /data/www/html -d zodream.cn -d test.zodream.cn

如果不同域名在不同文件夹,只需要设一个 -w 作为验证权限即可

更改 apache 站点配置,重启xampp

 <VirtualHost *:443>  
    ServerName zodream.cn
    DocumentRoot "/data/www/html"
    ServerAdmin webmaster@zodream.cn
    ServerName zodream.cn
    ServerAlias www.zodream.cn
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/zodream.cn/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/zodream.cn/privkey.pem
    ErrorLog "logs/dummy-www.zodream.cn-error_log"
    CustomLog "logs/dummy-www.zodream.cn-access_log" common
 </VirtualHost>

<Directory "/data/www/html">  
    DirectoryIndex index.php index.html index.htm 
    Options FollowSymLinks Includes ExecCGI  
    AllowOverride All  
    Order allow,deny  
    Allow from all  
</Directory>

使用

certbot renew --dry-run

安装自动更新证书

也可以手动更新证书

certbot renew

参考:

  1. certbot.eff.org

  2. certbot-importerror-pyopenssl-module-missing-required-functionality

Click here to view
0 1549 0