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啦
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。