您的位置:首页 > 理论基础 > 计算机网络

Apache开启https

2016-11-28 18:05 429 查看
apache 要支持https 必须要有mod_ssl软件
[root@bird www]# yum install mod_ssl
[root@www ~]# /etc/init.d/httpd restart

修改防火墙添加443

Centos 6.x 已经提供了预设的ssl机制所需私钥与凭证文件
* /etc/httpd/conf.d/ssl.conf mod_ssl提供的 Apache 设定文件;
* /etc/pki/tls/private/localhost.key 系統私钥文件,可以用來制作凭证的!
* /etc/pki/tls/certs/localhost.crt 就是加密过的凭证文件!(signed certificate)

添加了https 同一个页面http https都可访问 其实没什么意义 要把https和http的页面分离开

可以采用apache的虚拟机机制进行分离

[root@www ~]# mkdir /var/www/https
[root@www ~]# echo "This is https' home" > /var/www/https/index.html

修改 ssl.conf 的內容
[root@www ~]# vim /etc/httpd/conf.d/ssl.conf
Listen 443 <==预设的监听端口!不建议修改!
<VirtualHost _default_:443> <==就是虚拟主机的设定!
DocumentRoot "/var/www/https" <==大概84行,拿掉注释更改目录名称
ServerName *:443 <==拿掉注释,並将主机名称设定为 *
SSLEngine on <==支持 SSL 的意思!
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/vbird.crt
SSLCertificateKeyFile /etc/pki/tls/certs/vbird.key
</VirtualHost>

[root@www ~]# /etc/init.d/httpd restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  apache https 443