基于apache实现https
CA认证服务搭建见:
CA认证及搭建过程
实验环境: 基于centos6系统
- 安装httpd
[root@xinsz08-1 ~]# yum install httpd -y
- 修改http web服务器
[root@xinsz08-1 ~]# vim /etc/httpd/conf/httpd.conf
[root@xinsz08-1 ~]# service httpd restart
停止 httpd: [失败]
正在启动 httpd: [确定]
[root@xinsz08-1 ~]# iptables -F
- 客户端服务器生成证书请求文件,获得证书
[root@xinsz08-1 ~]# openssl genrsa -des3 -out /etc/httpd/conf.d/sever.key
Generating RSA private key, 1024 bit long modulus
................++++++
.......................++++++
e is 65537 (0x10001)
Enter pass phrase for /etc/httpd/conf.d/sever.key:
Verifying - Enter pass phrase for /etc/httpd/conf.d/sever.key:
- 使用私钥生成请求文件
[root@xinsz08-64 ~]# openssl req -new -key /etc/httpd/conf.d/server.key -out /server.csr #注意后期添加的国家,省,组织等信息要和CA保持一致
Enter pass phrase for /etc/httpd/conf.d/server.key:123456 #输入私钥的密码
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:beijing
Locality Name (eg, city) [Default City]:haidian
Organization Name (eg, company) [Default Company Ltd]:zmedu
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:xinsz08-64.cn
#这里要求输入的CommonName必须与通过浏览器访问您网站的 URL 完全相同,否则用户会发 现您服务器证书的通用名与站点的名字不匹配,用户就会怀疑您的证书的真实性。可以使域名也可以 使IP地址。
Email Address []:1@163.comPlease enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: #不输密码直接回车
An optional company name []:
注:证书请求文件中有xinsz08-64的公钥。 这个公钥是在生成证书请求文件时,通过指定的私钥 /etc/httpd/conf.d/server.key生成的。
常识: 通过私钥可以生成公钥的,通过公钥不可以推出来私钥。
5、将证书请求文件发给CA服务器:
[root@xinsz08-64 ~]# scp /server.csr 192.168.1.63:/tmp/
- 签名
[root@xinsz08-62 ~]# openssl ca -h
[root@xinsz08-62 ~]# openssl ca -keyfile /etc/pki/CA/private/cakey.pem -cert /etc/pki/CA/cacert.pem -in /tmp/server.csr -out /server.crt
Using configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for /etc/pki/CA/private/cakey.pem:123456
Check that the request matches the signature
Signature ok
Certificate Details:Serial Number:ce:60:e0:a3:fe:ee:88:09ValidityNot Before: Dec 21 14:25:53 2014 GMTNot After : Dec 21 14:25:53 2015 GMTSubject:countryName = CNstateOrProvinceName = beijingorganizationName = xzmeduorganizationalUnitName = ITcommonName = xinsz08-64.cnemailAddress = 1@163.comX509v3 extensions:X509v3 Basic Constraints: CA:TRUENetscape Comment: OpenSSL Generated CertificateX509v3 Subject Key Identifier: 1B:30:0B:28:4A:31:EA:FC:05:7D:54:A3:87:A0:6E:BE:F8:D6:3C:F8X509v3 Authority Key Identifier: keyid:6D:0F:0C:C5:96:32:A8:8B:D3:FF:36:39:5B:14:5B:9B:31:12:4A:C3Certificate is to be certified until Dec 21 14:25:53 2015 GMT (365 days) #证书有效期是365天。证书进行认证,直到12月21日十四时25分53秒格林尼治标准时间2015年(365天)
Sign the certificate? [y/n]:y #注册证书
1 out of 1 certificate requests certified, commit? [y/n]y #确认
Write out database with 1 new entries
Data Base Updated
7、将证书复制到xinsz08-64
[root@xinsz08-62 ~]# scp /server.crt 192.168.1.64:/
到此证书签名完毕。
使用证书实现https
18.4.2 在xinsz08-64上配置HTTPS web服务器
1、安装SSL模块
[root@xinsz08-64 ~]# yum install mod_ssl -y
2、配置apache加载证书文件
[root@xinsz08-64 ~]# cp /server.crt /etc/httpd/conf.d/ #复制证书
[root@xinsz08-64 ~]# ls /etc/httpd/conf.d/server.key #查看私钥
/etc/httpd/conf.d/server.key
[root@xinsz08-64 ~]# vim /etc/httpd/conf.d/ssl.conf
改:100 SSLCertificateFile /etc/pki/tls/certs/localhost.crt
为:100 SSLCertificateFile /etc/httpd/conf.d/server.crt改:107 SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
为:107 SSLCertificateKeyFile /etc/httpd/conf.d/server.key
3、启动服务:
[
root@xinsz08-64 ~]# systemctl restart httpd
Enter SSL pass phrase for xinsz08-64.cn:443 (RSA) : 123456 #httpd私钥密码
4、测试https,查看端口
[root@xinsz08-64 ~]# netstat -antup | grep 443
tcp 0 0 :::443 :::* LISTEN 5138/httpd
5、通过浏览器测试https效果
访问IP
查看浏览器上的证书
基于apache实现https相关推荐
- 基于Apache Spark的机器学习及神经网络算法和应用
使用高级分析算法(如大规模机器学习.图形分析和统计建模等)来发现和探索数据是当前流行的思路,在IDF16技术课堂上,英特尔公司软件开发工程师王以恒分享了<基于Apache Spark的机器学习及 ...
- 基于Apache Thrift的公路涵洞数据交互实现原理
基于Apache Thrift的公路涵洞数据交互实现原理 Apache Thrift简介 Apache Thrift(以下简称为"Thrift") 是 Facebook 实现的一种 ...
- 技术干货|基于Apache Hudi 的CDC数据入湖
简介:阿里云技术专家李少锋(风泽)在Apache Hudi 与 Apache Pulsar 联合 Meetup 杭州站上的演讲整理稿件,本议题将介绍典型 CDC 入湖场景,以及如何使用 Pulsar/ ...
- 基于 Apache Flink + Hologres 的实时推荐系统架构解析
简介:<实时数仓入门训练营>由阿里云研究员王峰.阿里云高级产品专家刘一鸣等实时计算 Flink 版和 Hologres 的多名技术/产品一线专家齐上阵,合力搭建此次训练营的课程体系,精心打 ...
- 基于openssl的https服务的配置
openssl实现私有CA,并配置基于openssl的https服务的配置,原理如下图 在CA服务器上实现私有CA步骤如下: 1.生成一对密钥 2.生成自签证书 基本的配置如下代码; [root@CA ...
- [原创]在windows下搭建基于apache的SVN环境
[原创]在windows下搭建基于apache的SVN环境 1 软件下载: 在http://httpd.apache.org/download.cgi,下载: apache_2.2.14-win32- ...
- 实时数仓入门训练营:基于 Apache Flink + Hologres 的实时推荐系统架构解析
简介: <实时数仓入门训练营>由阿里云研究员王峰.阿里云资深技术专家金晓军.阿里云高级产品专家刘一鸣等实时计算 Flink 版和 Hologres 的多名技术/产品一线专家齐上阵,合力搭建 ...
- 基于 Apache Mahout 构建社会化推荐引擎
http://www.ibm.com/developerworks/cn/java/j-lo-mahout/ Web 2.0 的一个核心思想就是"群体智慧",即基于大众行为,为每个 ...
- sql2java-excel(二):基于apache poi实现数据库表的导出的spring web支持
sql2java是我几年年开始写的一个sql2java是一个轻量级数据库(SQL)访问代码(java)生成器.这几年一直在根据工作需要维护升级,最近的项目中需要对数据库的记录提供导出excel的功能. ...
最新文章
- 用 C 语言开发一门编程语言 — 条件分支
- 4.1.3 文件目录
- PHP输出毫秒时间戳
- Spring4 MVC文件下载实例
- 关于simulink中参数传递到工作空间
- Laravel核心解读 -- 用户认证系统(基础介绍)
- Flutter: MobX和flutter_mobx状态管理器
- java程序dna,蓝桥杯——DNA(Java题解)
- c语言浪漫烟花表白,C语言实战之浪漫烟花表白程序.pdf
- 你肯定用过手机护眼模式, 但你知道怎么将电脑Win10窗口背景色修改为护眼的淡绿色吗?(附带如何备份注册表)
- Nginx 重写功能(location / rewrite)
- 自动驾驶专题介绍 ———— 动力传动系统
- Android手机图片上传 选择不了本地照片 解决方案
- 大数据学习的第一课-大数据概论和技术原理
- 【C语言教程】1、C 语言简介
- 基于机器学习算法对电动汽车能耗估计
- Dart list数组集合类型
- Cmaker 是什么
- 教商家们如何设置一个在线的转盘抽奖活动!
- 很有意思的电话会议 老张明显内力更加深厚
热门文章
- 使用Easyexcel对Excel进行读写操作
- 求函数:x的n次方(函数递归)
- A类计算机机房温度变化,机房的温度、湿度标准值是多少 ?
- unity ,color组件
- python 答题卡识别_opencv+python机读卡识别整合版
- 如何绘制程序流程图?绘制程序流程图工具介绍及功能讲解
- php密钥,php – 唯一的密钥生成
- oracle中的declare
- 关于1 problem (1 error, 0 warnings) 1 error and 0 warnings potentially fixable with the `--fix` 错误
- 识别图片上的文字,如何在线识别?