当前位置: 移动技术网 > 网络运营>服务器>Linux > apache https配置详细步骤讲解

apache https配置详细步骤讲解

2019年05月06日  | 移动技术网网络运营  | 我要评论
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能看到正确的显示。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网