1、生成密钥
# openssl genrsa 1024 > server.key
这是用128位rsa算法生成密钥,并保存到server.key文件

2、生成证书请求文件
# openssl req -new -key server.key > server.csr

Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:Zhejiang
Locality Name (eg, city) [Newbury]:Hangzhou
Organization Name (eg, company) [My Company Ltd]:My Application
Organizational Unit Name (eg, section) []:My Application
Common Name (eg, your name or your server's hostname) []:www.www.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:My Application

3、生成证书
# openssl req -x509 -days 730 -key server.key -in server.csr > server.crt
参数-days表示证书有效期

至此证书完毕,开始配置httpd,因为已经在运行httpd

httpd重新编译追加ssl:
1、重新编译
make clean
make clean all
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most --enable-ssl &&
make &&
make install
2、编辑httpd.conf文件,添加
LoadModule ssl_module modules/mod_ssl.so
3、加载ssl配置
Include conf/httpd-ssl.conf
4、注意修改证书配置
SSLCertificateFile /apache/conf/server.crt
SSLCertificateKeyFile /apache/conf/server.key
5、因为自定义了DocumentRoot,所以也要修改httpd-ssl.conf的DocumentRoot

起来后发现日志里总是有以下错误:

[notice] caught SIGTERM, shutting down
[Wed Mar 26 21:53:02 2014] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Mar 26 21:53:02 2014] [warn] RSA server certificate CommonName (CN) `serv' does NOT match server name!?

apache 配置https的更多相关文章

  1. Apache配置HTTPS功能

    apache配置https 一.yum 安装openssl和openssl-devel,httpd-devel 二.生成证书(也可以从公司的证书颁发机构获取): #建立服务器密钥 openssl ge ...

  2. Windows上为Apache配置HTTPS

    Windows上为Apache配置HTTPS   转 https://www.cnblogs.com/tianzijiaozi/p/7582671.html   1. 安装OpenSSL: Windo ...

  3. Linux下Apache配置HTTPS功能

    Apache配置HTTPS功能  转 https://www.cnblogs.com/liaojiafa/p/6028816.html 一.yum 安装openssl和openssl-devel,ht ...

  4. Apache配置https

    Apache配置https 之前一直用的是Tomcat,今天突然接到任务要给Apache配置https证书,因为小程序要用.下面把过程列出来以备后续查看. 1.首先你得有ssl证书,没有的可以去购买, ...

  5. 在linux下的apache配置https协议,开启ssl连接

    环境:linux 配置https协议,需要2大步骤: 一.生成服务器证书 1.安装openssl软件 yum install -y openssl mod_ssl 2.生成服务器私匙,生成server ...

  6. apache 配置https(转)

    主要讲述在windows下apache配置SSL以实现http转换为https SSL: SSl是为Http传输提供安全的协议,通过证书认证来确保客户端和网站服务器之间的数据是安全.也就是说在SSL下 ...

  7. lamp之apache配置https访问

    配置apache 使用https 注:怕其他人由于路径的原因出问题,首先声明一下,本人apache的安装目录为 : /usr/local/httpd2.4.25,如果不是,请参考进行配置 注: 对于如 ...

  8. Linux Apache配置https访问

    配置https访问 该环境是rh254课程配套的一个环境,不过配置方法步骤相同. 要求: 使用虚拟主机技术部署两个网站: 网站1: 绑定域名 www0.example.com 目录在 /srv/www ...

  9. Apache 配置Https 转发Tomcat Http

    Apache 相对于nginx的配置对比起来相当复杂啦,朋友之前的系统使用的是Apache需要增加一个虚拟主机,主要配置从Apache转发Tomcat. 首先需要拆解下步骤: Apache 支持Htt ...

  10. apache配置https协议

    安装openssl有两种方式,第一种直接下载安装包,装上就可运行:第二种可以自己下载源码,自己编译.下面对两种方式均进行详细描述. 一.下载和安装openss 方法一:直接使用openssl安装包 W ...

随机推荐

  1. 运放——压摆率SR的意义和如何选取

    http://blog.csdn.net/dxshappy/article/details/8065798

  2. Svn常见问题及相关原因

    1. svn: Server sent unexpected return value (500 Internal Server Error) in response to OPTIONS reque ...

  3. 最大流 总结&&做题记录

    最近一直很忙,为了节省时间,从今以后的题解会 一个专题 写一篇. 刷了一些题后,有了以下总结: 模型要点: 1.构造流量平衡,在满足流量平衡的情况下,找到要让什么最大. 2.一般用于判断性问题,即所有 ...

  4. UIView及其子类

    一.UI概述 UI(User Interface):用户界⾯,用户能看到的各种各样的⻚面元素. iOS App = 各种各样的UI控件 + 业务逻辑和算法 二.UIView 在手机上显示的内容都是UI ...

  5. Rhel6-varnish配置文档

    系统环境: rhel6 x86_64 iptables and selinux disabled 主机: 192.168.122.160:virnish apache server60.example ...

  6. js动画之简单运动二

    透明度的变化 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...

  7. hdu 1039 (string process, fgets, scanf, neat utilization of switch clause) 分类: hdoj 2015-06-16 22:15 38人阅读 评论(0) 收藏

    (string process, fgets, scanf, neat utilization of switch clause) simple problem, simple code. #incl ...

  8. 用maven搭建 testNG+PowerMock+Mockito测试框架

    单元测试是开发中必不可少的一部分,是产品代码的重要保证. Junit和testNG是当前最流行的测试框架,Junit是使用最广泛的测试框架,有兴趣的话自己baidu一下. testNG基于Junit和 ...

  9. Oracle帮助类

    /// <summary> /// Copyright (C) Maticsoft /// 数据访问基础类(基于Oracle) /// 可以用户可以修改满足自己项目的需要. /// < ...

  10. js 轮播图代码

    js代码 (function(){ /** parent //父容器 changeTime //每次间隔几秒切换下一条 leaveTime //鼠标从小图上离开过后几秒继续切换 index //从第几 ...