售前咨询
技术支持
渠道合作

Apache 配置支持HTTPS的SSL证书

需求简介

基于nginx搭建了一个https访问的虚拟主机,监听的域名如trustauth.cn,但是很多用户不清楚https和http的区别,会很容易敲成http://trustauth.cn,这时会报出404错误,所以需要做基于trustauth.cn域名的http向https的强制跳转,下面详细介绍在windows系统 Apache 配置支持HTTPS的SSL证书

windows   Apache 配置支持HTTPS的SSL证书

1.安装apache,下载带有ssl版本的apache安装程序。

( 本次实验用的是 apache_2.2.8-win32-x86-openssl-0.9.8g.msi程序包.)

2.安装完apache之后,检查apache目录下是否有以下文件:

[Apache安装目录]/modules/ mod_ssl.so

[Apache安装目录]/bin/ openssl.exe, libeay32.dll, ssleay32.dll, openssl.cnf

[Apache安装目录]/conf/ openssl.cnf

*(一般bin下没有openssl.cnf,把conf下的Openssl.cnf拷贝过去)

3.打开cmd,进入apache安装目录bin下:

步骤一:

执行命令: openssl genrsa 1024 >server.key  (RSA密钥对的默认长度是1024,取值是2的整数次方,并且密钥长度约长,安全性相对会高点.)

步骤二:

生产为签署的server.csr

执行命令:openssl req -new -config openssl.cnf -key server.key >server.csr

(如果不加-config openssl.cnf参数的话,常会报Unable to load config info from …/ssl/openssl.cnf)

执行完此条命令,会要求输入一系列参数:

country Name (2 letter code) [AU]:CN ISO 国家代码(只支持两位字符)

State or Province Name (full name) [Some-State]:ZJ 所在省份

Locality Name (eg, city) []:HZ 所在城市

Organization Name (eg, company): 公司名称

Organizational Unit Name (eg, section) [: 组织名称

Common Name (eg, YOUR name) ]: 申请证书的域名(必须和httpd.conf中serverName必须一致)

Email Address []:admin@admin.com 管理员邮箱

Please enter the following ‘extra’ attributes to be sent with your certificate request A challenge password []: 交换密钥

An optional company name []:

注:Common Name必须和httpd.conf中serverName必须一致,否则apache不能启动(启动 apache 时错误提示为:server RSA certificate CommonName (CN) `Kedou’ does NOT match server name!? )

完成签署的server.csr配置。

步骤三:

签署服务器证书文件 server.crt

执行命令:openssl req -x509 -days 5000 -config openssl.cnf -key server.key -in server.csr >server.crt

(说明:这是用步骤 1,2 的的密钥和证书请求生成证书 server.crt,-days 参数 指明证书有效期,单位为天,x509 表示生成的为 X.509 证书。)

步骤四:

在bin 目录下,找到tian_server.crt、tian_server.csr、tian_server.key三个文件,将此三个文件剪切到Apache的conf目录下。

步骤五:

编辑配置文件httpd.conf ,找到下列两行,删除注释。

loadModule ssl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf (注:改成httpd-ssl.conf)

步骤六:

修改apache安装目录下,conf\extra ,编辑httpd_ssl_conf

SSLCertificateFile    E:\apache\conf\key\server.crt    (服务器证书的位置)

SSLCertificateKeyFile    E:\apache\conf\key\server.key (服务器私钥的位置)

重启apache,通过访问https:// 即可。

SSL证书采用了技术含量比较高的加密技术。日后GDCA(数安时代)将会持续为大家推荐更多关于SSL证书的技术知识。让大家正确认识SSL证书,快速无误部署HTTPS安全协议。

相关搜索

  • apache ssl
  • apache ssl配置
  • apache ssl证书配置
  • apache ssl 证书
  • apache没有mod ssl.so
  • apache安装mod ssl.so
  • apache安装ssl证书
  • apache mod ssl.so
  • apache安装ssl模块

上一篇:

下一篇:

相关新闻

 

领取优惠
免费预约

申请试用SSL证书

提交成功!

咨询客服