Apache 启用 https 配置步骤

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值