1、准备好ssl证书
准备好服务器配置需要的ssl证书,这个证书应该是域名ssl证书颁发机构那边给你的
server.cer
server.key
2、配置https
https的配置文件一般在apache目录的下面 : conf/extra/httpd-ssl.conf
# 默认是443端口
Listen 443
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
SSLHonorCipherOrder on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLPassPhraseDialog builtin
SSLSessionCache "shmcb:/usr/local/apache/logs/ssl_scache(512000)"
SSLSessionCacheTimeout 300
<VirtualHost _default_:443>
# 默认站点根目录
DocumentRoot "/home/www"
# 默认站点域名
ServerName xxxxx.com:443
ServerAdmin admin@example.com
ErrorLog "/usr/local/apache/logs/error.log"
TransferLog "/usr/local/apache/logs/access.log"
SSLEngine on
# 证书配置
SSLCertificateFile "/usr/local/apache/conf/key/server.cer"
SSLCertificateKeyFile "/usr/local/apache/conf/key/server.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/local/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
<Directory "/home/www">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "/usr/local/apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
3、开启https模块
在apache主配置文件httpd.conf中,开启https模块库文章来源:https://www.toymoban.com/news/detail-510170.html
LoadModule ssl_module modules/mod_ssl.so
并且将https的配置文件引入主配置文件中文章来源地址https://www.toymoban.com/news/detail-510170.html
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
到了这里,关于Apache 启用 https 配置步骤的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!