CentOS7.2下SSL证书的配置

HTTPS的配置

2017-07-28


准备

假设CentOS7 已经安装了Apache Web服务器.

 yum install mod_ssl openssl

安装完毕后,会自动生成 /etc/httpd/conf.d/ssl.conf 文件

然后就是相关的证书要准备好
SSL证书
这里用的是腾讯云免费的TrustAsia的SSL证书,解压后取Apache的证书传至服务器。
证书
上传至服务器后,接下来配置Apache
配置Apache Web服务器

首先,修改下面的配置文件。只需要需配置红色部分 SSLCertificateFile 和 SSLCertificateKeyFile,把目录换成你所对应的上传证书的目录

  # vim /etc/httpd/conf.d/ssl.conf

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

  ##
  ## SSL Virtual Host Context
  ##

  <VirtualHost _default_:443>
  # General setup for the virtual host, inherited from global    configuration

  DocumentRoot "/var/www/html/a.com"
  ServerName www.a.com:443

  ### overwrite the following parameters ###

SSLCertificateFile     /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key

  ### The following parameter does not need to be modified in case of a self-signed certificate. ###
  ### If you are using a real certificate, you may receive a certificate bundle. The bundle is added using the following parameters ###
  SSLCertificateChainFile /etc/pki/tls/certs/example.com.ca-bundle

然后,重新启动httpd服务使更改生效

 systemctl restart httpd

Web服务器现在就可以使用HTTPS啦

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值