certbot--apache

这篇博客介绍了如何在Python 2.7环境下,利用certbot工具为Apache服务器安装HTTPS证书。首先,参照certbot官网教程,通过wget下载certbot-auto安装包。接着,在Nginx的virtualhost配置中设置Namevirtualhost监听443端口。对于Apache,采用yum安装,并在/etc/httpd/conf.d目录下创建虚拟站点配置文件。运行`./certbot-auto --apache certonly`进行证书申请。完成证书获取后,certbot会在/etc/letsencrypt/live/abc.wang.com目录下生成相关文件,并在Apache的配置目录下新增ssl.conf和virtual-le-ssl.conf文件。
摘要由CSDN通过智能技术生成

在python2.7的基础之上
使用certbot来安装网站证书支持https
官网教程 https://certbot.eff.org/
安装包 wget https://dl.eff.org/certbot-auto
nginx 网站下
首先得有virtualhost 配置虚拟站点,启用Namevirtualhost监听433端口
apache采用的yum安装

vim /etv/httpd/conf/httpd.conf
Listen 443
NameVirtualHost *:443

在/etc/httpd/conf.d 添加虚拟站点配置文件
virtual.conf

<Virtualhost *:80>
        DocumentRoot /var/www/html/abc
        ServerName abc.wang.com
       <Directory "/var/www/html/abc">
            Options Indexes FollowSymLinks
            DirectoryIndex index.html
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    RewriteEngine on   #1 123为certbot自创添加
    RewriteCond %{SERVER_NAME} =abc.wang.tv #2
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent] #3
    </virtualhost>

./certbot-auto --apache certonly
证书完成后
在/etc/letsencrypt/live/abc.wang.com目录下有

cert.pem  chain.pem  fullchain.pem  privkey.pem  README

这时在/etc/httpd/conf.d目录下多了几个文件

virtual.conf  virtual-le-ssl.conf  README  ssl.conf    welcome.conf

ssl.conf

#
# This is the Apache server configuration file providing SSL support.
# It contains the configuration directives to instruct the server how to
# serve pages over an https connection. For detailing information about these 
# directives see <URL:http://httpd.apache.org/docs/2.2/mod/mod_ssl.html>
# 
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#

LoadModule ssl_module modules/mod_ssl.so

#
# When we also provide SSL we have to listen to the 
# the HTTPS port in addition.
#
Listen 443

##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is a internal
#   terminal dialog) has to p
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值