织梦CMS - 轻松建站从此开始!

罗索

当前位置: 主页>杂项技术>Web>

apache 配置https

落鹤生 发布于 2012-03-30 11:30 点击:次 
主要讲述在windows下apache配置SSL以实现http转换为https
TAG:

主要讲述在windows下apache配置SSL以实现http转换为https

SSL: SSl是为Http传输提供安全的协议,通过证书认证来确保客户端和网站服务器之间的数据是安全。也就是说在SSL下http传输是安全的,我们成为https.

过程:

步骤一:安装apache,使其支持SSL,并安装php

1.安装配有SSL模块的apache,apache_2.2.8-win32-x86-openssl-0.9.8g
2.配置apache以支持SSL:打开apache的配置文件conf/httpd.conf
1)LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
去掉两行前面的#
2)注意修改httpd-ssl.conf 文件里的两个字段:
SSLCertificateFile "C:/Apache2.2/conf/server.crt"
SSLCertificateKeyFile "C:/Apache2.2/conf/server.key"
3.安装php,整合apache和Php(略)
为下面你所生成的证书和密钥地址。

步骤二:为网站服务器生成证书及私钥文件

1. 生成服务器的私钥
进入命令行:
D:/local/apache2/bin/openssl genrsa -out server.key 1024
在当前目录下生成了一个server.key生成签署申请
2. 生成签署申请
D:/local/apache2/bin>openssl req -new -out server.csr -key server.key -config ../conf/openssl.cnf
此时生成签署文件server.csr.

步骤三:通过CA为网站服务器签署证书

1.生成CA私钥
D:/local/apache2/bin/openssl genrsa -out ca.key 1024
多出ca.key文件
2.利用CA的私钥产生CA的自签署证书
D:/local/apache2/bin/openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ../conf/openssl.cnf
此时需要输入一些信息,注意Common Name为服务器域名,如果在本机,为本机IP。
3.CA为网站服务器签署证书
D:/local/apache2/bin/openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ../conf/openssl.cnf
但,此时会报错:
于是在在当前目录创建demoCA,里面创建以下文件,index.txt,serial:serial内容为01,其他为空,以及文件夹newcert.再执行一遍,即可生成server.crt文件

步骤四:然后将 server.crt,server.key复制到apache的conf文件夹下,重启apache

步骤五:配置windows.

打开C:/WINDOWS/system32/drivers/etc下的etc文件:
修改为:
127.0.0.1 next0-testing.acgchina.8866.org
127.0.0.1 pp-testing.acgchina.8866.org
127.0.0.1 tlink-testing.acgchina.8866.org

步骤四:

在apache下写入iframe网页,并将testlink,projectpier也放入。
<iframe src="https://pp-testing.acgchina.8866.org/projectpier/index.php" width="300" height="300"></iframe>

<iframe src="https://tlink-testing.acgchina.8866.org/testlink/index.php" width="300" height="300"></iframe>

于是访问https://next0-testing.acgchina.8866.org能看到正确的显示。

(lijiang)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201203/15886.html]
本文出处:lijiang.javaeye.com 作者:lijiang 原文
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容