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模块库
LoadModule ssl_module modules/mod_ssl.so
并且将https的配置文件引入主配置文件中
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf