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. iOS开发UI篇—模仿ipad版QQ空间登录界面

    iOS开发UI篇—模仿ipad版QQ空间登录界面 一.实现和步骤 1.一般ipad项目在命名的时候可以加一个HD,标明为高清版 2.设置项目的文件结构,分为home和login两个部分 3.登陆界面的 ...

  2. 学习Django

    1.安装 命令:pip install Django 安装慢且有异常:HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed ...

  3. [ie兼容]ie7浮动左在前,浮动右在后导致右边浮动的元素掉下来

    解决办法:左浮动和右浮动元素在结构上互换位置 http://blog.sina.com.cn/s/blog_818a1e5b0100wp5b.html

  4. 简单研究Android View绘制一 测量过程

    2015-07-27 16:52:58 一.如何通过继承ViewGroup来实现自定义View?首先得搞清楚Android时如何绘制View的,参考Android官方文档:How Android Dr ...

  5. ubuntu fix the grub boot(need Internet)

    sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install -y boot- ...

  6. OC中快速创建NSNumber NSDictionary NSArray的方法

    NSNumber: @()     @小括号 或者        NSNumber * num = @3;    NSValue * value = @4; NSDictionary :@{} @大括 ...

  7. Python使用CGIHTTPServer调用shell作为cgi脚本

    #!/bin/bash echo "Content-Type:text/html" echo "" echo "hello world!" ...

  8. SQL分类

    SQL(Structure Query Language)结构化查询语言,是使用关系型数据库的应用语言. SQL主要可以划分为以下三个类别: DDL(Data Define Language)语句:数 ...

  9. ubuntu14.04 键盘错位小问题

    分享一个ubuntu14.04里的小问题,不知道有没有人跟我一样悲催 问题: 键盘错位了,@和"两个符合正好颠倒,~#这几个也错乱了,~符号跑到了|上,#跑到了shift+|上,这个问题在敲 ...

  10. colormap

    http://cn.mathworks.com/help/matlab/ref/colormap.html