Apache2.4版本增加ssl模块记录

文章索引:SSLCertificateFile: file '/etc/httpd/server.crt' does not exist or is empty

 

步骤1:修改配置文件
$ vi  /usr/local/apache/conf/httpd.conf
#去掉这里注释
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
#增加下面这行
Include /etc/httpd/extra/httpd-ssl.conf

</IfModule>
步骤2:重启
[root@GWZNFXYHPT17 ~]# service httpd start
正在启动 httpd:AH00526: Syntax error on line 106 of /etc/httpd/extra/httpd-ssl.conf:
SSLCertificateFile: file '/etc/httpd/server.crt' does not exist or is empty
[失败]

步骤3:处理报错
 第一步:生成密钥 
命令:openssl genrsa 2048 > /etc/httpd/server.key 
说明:这是用256位rsa算法生成密钥,得到server.key文件 

第二步: 生成证书请求 
命令:openssl req -new -key /etc/httpd/server.key > /etc/httpd/server.csr 
说明:这是用步骤1的密钥生成证书请求文件server.csr
[root@GWZNFXYHPT17 ~]# openssl req -new -key /etc/httpd/server.key > /etc/httpd/server.csr
...
Country Name (2 letter code) [AU]:cn
State or Province Name (full name) [Some-State]:guangdong
Locality Name (eg, city) []:guangzhou
Organization Name (eg, company) [Internet Widgits Pty Ltd]:skyvision
Organizational Unit Name (eg, section) []:cattsoft
Common Name (e.g. server FQDN or YOUR name) []:root
Email Address []:cattsoft
A challenge password []: ← 可以不输入 
An optional company name []: ← 可以不输入

第三步: 生成证书请求 
命令:openssl req -x509 -days 3650 -key /etc/httpd/server.key -in /etc/httpd/server.csr > /etc/httpd/server.crt 
说明:这是用步骤1,2的的密钥和证书请求生成证书server.crt,-days参数指明证书有效期,单位为天 

 

到这里就可以尝试启动apache了

service httpd restart 

这个启动默认配置文件在 /etc/httpd/httpd.conf

或者指定配置文件启动

[root@GWZNFXYHPT17 apache]# ./bin/httpd  -k start -f  ./conf/httpd.conf

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值