centos7 xampp 配置Let's Encrypt 证书

Fork Me On Github
zodream 编程技术 2017年10月

centos7 xampp 配置Let's Encrypt 证书

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

尝试

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

shell
  
yum install certbot-apache
12

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

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

清除之前操作

shell
  
yum remove certbot pyOpenSSL
12

准备

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

shell
     
yum -y install epel-release

yum -y install python-pip

pip install --upgrade pip
12345

安装

安装最新版

shell
   
pip install pyOpenSSL

pip install certbot
123

申请ssl 绑定路径

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

如果有多个域名

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

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

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

更改 apache 站点配置,重启xampp

conf
                    
 <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>
1234567891011121314151617181920

使用

shell
 
certbot renew --dry-run
1

安装自动更新证书

也可以手动更新证书

shell
 
certbot renew
1

参考:

  1. certbot.eff.org

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

点击查看全文
0 1571 0