apache 配置 - ssl

来源:互联网 发布:sai for mac 编辑:程序博客网 时间:2024/06/05 06:48

1. 下载apache:记得下载带有openssl的版本。否则要自己去下openssl了。

2. 生成测试证书

a. 进入cmd,切换目录到apach/conf下。

b. 调用openssl,输入:../bin/openssl.exe-> 出现OpenSSL提示符

c. 生成key文件,输入:genrsa -out server.key 1024

d. 生成未签署的server.csr,输入:req -new -key server.key -out server.csr -config openssl.cnf。

    注意:Common Name和httpd.conf中的ServerName必须一致,否则apache不能启动。

e. 签名,输入:x509 -req -days 365 -in server.csr -signkey server.key -out  server.crt。可用x509 -noout -text -in server.crt查看证书的内容。

3. 配置

a. conf/httpd.conf :取消这两行的注释

LoadModule ssl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

修改:ServerName 127.0.0.1:80

b. conf/extra/httpd-ssl.conf

修改:ServerName 127.0.0.1:443

4. 重启appache


原创粉丝点击