CentOS7.2下SSL证书的配置

前端之家收集整理的这篇文章主要介绍了CentOS7.2下SSL证书的配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

HTTPS的配置


准备

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

yum install mod_ssl openssl

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

然后就是相关的证书要准备好

这里用的是腾讯云免费的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
##


# 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啦

原文链接:https://www.f2er.com/centos/376552.html

猜你在找的CentOS相关文章