Web的加密访问(https)
这里httpd以装上
拓扑如下:
<a href="http://blog.51cto.com/attachment/201210/194149938.png" target="_blank"></a>
1.实现CA认证中心
编辑/etc/pki/tls/openssl.cnf
<a href="http://blog.51cto.com/attachment/201210/194204717.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201210/194217220.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201210/194240863.png" target="_blank"></a>
Cd /etc/pki/CA 新建上图中带箭头的目录和文件,并且给serial文件一个初始编号“01”
[root@RHEL CA]# mkdir crl certs newcerts
[root@RHEL CA]# touch index.html serial
[root@RHEL CA]# echo "01" >serial
<a href="http://blog.51cto.com/attachment/201210/194304919.png" target="_blank"></a>
产生自己的私钥
<a href="http://blog.51cto.com/attachment/201210/194323434.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201210/194335564.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201210/194347117.png" target="_blank"></a>
创建自己的证书文件
<a href="http://blog.51cto.com/attachment/201210/194402830.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201210/194420754.png" target="_blank"></a>
2.安装mod_ssl
[root@RHEL yum.repos.d]# yum -y install mod_ssl
在/etc/httpd/conf.d/里会增加一个ssl.conf文件
3.产生web的私钥,并放在/etc/httpd/certs/目录里
[root@RHEL ~]# mkdir -pv /etc/httpd/certs
[root@RHEL ~]# cd /etc/httpd/certs/
<a href="http://blog.51cto.com/attachment/201210/194441314.png" target="_blank"></a>
创建请求文件
<a href="http://blog.51cto.com/attachment/201210/194503362.png" target="_blank"></a>
在CA中心发布该证书
<a href="http://blog.51cto.com/attachment/201210/194532904.png" target="_blank"></a>
<a href="http://blog.51cto.com/attachment/201210/194547383.png" target="_blank"></a>
会在/etc/httpd/certs/目录里产生以上三个文件
<a href="http://blog.51cto.com/attachment/201210/194557203.png" target="_blank"></a>
4.编辑ssl.conf文件使证书和web关联
<a href="http://blog.51cto.com/attachment/201210/194610453.png" target="_blank"></a>
关闭80端口,是网站用443端口及https访问
#Listen 80
5.在客户机端测试
<a href="http://blog.51cto.com/attachment/201210/194624995.png" target="_blank"></a>
会出现上述情况
单击"查看证书"—>"证书路径"如下:
<a href="http://blog.51cto.com/attachment/201210/194637576.png" target="_blank"></a>
没用根证书
可以这样做-编辑vim /etc/httpd/conf.d/ssl.conf(开启128行)
<a href="http://blog.51cto.com/attachment/201210/194649974.png" target="_blank"></a>
Cacert.pem为根证书
再次单击"查看证书"——>"证书路径"如下:
<a href="http://blog.51cto.com/attachment/201210/194719924.png" target="_blank"></a>
有根证书了
单击"查看证书">"常规">"安装证书">"下一步"如下:
<a href="http://blog.51cto.com/attachment/201210/194731221.png" target="_blank"></a>
"下一步">"完成">"是">"确定"
再次访问该站点
<a href="http://blog.51cto.com/attachment/201210/194745574.png" target="_blank"></a>
已变成对号
<a href="http://blog.51cto.com/attachment/201210/194816983.png" target="_blank"></a>
这里我们就直接修改一下本机的hosts文件(为了方便)如下:路径(C:\WINDOWS\system32\drivers\etc)
<a href="http://blog.51cto.com/attachment/201210/194828882.png" target="_blank"></a>
有域名访问该站点
<a href="http://blog.51cto.com/attachment/201210/194842201.png" target="_blank"></a>
可以了,没用任何提示了。。结束。。。!
注:上面有几个地方需要重启httpd服务。
本文转自 abc16810 51CTO博客,原文链接:http://blog.51cto.com/abc16810/1034802