当前位置: 首页 > 编程日记 > 正文

Centos 64位 Install certificate on apache 即走https协议

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

一:

  先要apache 请求ssl证书的csr 一下是步骤:

重要注意事项 An Important Note Before You Start

在生成CSR文件时同时生成您的私钥,如果您丢了私钥或忘了私钥密码,则颁发 证书给您后不能安装成功!您必须重新生成私钥和CSR文件,免费重新颁发新的 证书。为了避免此情况的发生,请在生成CSR后一定要备份私钥文件和记住私钥 密码,最好是在收到证书之前不要再动服务器。 By far the most common problem users have when going through this process is related to private keys. If you lose or cannot access a private key, you cannot use the certificate we issue to you and will need to request a free reissue. To ensure this never happens, we advise that a backup of the private key file is made and that a note is made of the password that is used to protect the export of the private key.

“openssl”用于生成私钥和CSR,OpenSSL一般安装在/user/bin下,如果您的 系统安装在其他目录,请指定正确的目录路径。 The utility "openssl" that you use to generate the private key and CSR comes with the OpenSSL toolkit and is usually installed under /usr/bin. If you have installed it elsewhere you will need to modify these instructions appropriately.

以下所有命令假设您已经成功安装OpenSSL,将产生2048位的密钥,加密算法 采用3DES,您必须使用您要申请SSL证书的域名来命名密钥文件。 The following sequence of commands will generate a 2048 bit key, encrypt it using the triple-DES cipher, and create a CSR based upon it (they assume that you have openssl in your path - if not then you should prefix the openssl command with the path to the binary). You should use the domain name that you are wishing to have certified as the core of the filenames. You should also make sure you do not overwrite existing keys and CSR's:

1. 生成私钥 Generate the private key

请使用以下命令来生成私钥 Please type the following command at the prompt:

openssl genrsa -des3 -out www.mydomain.com.key 2048

www.mydomain.com.key,会提示您设定私钥密码,请设置密码,并牢记!
This command will generate a 1024 bit RSA private key and stores it in
the file www.mydomain.com.key. It will ask you for a pass phrase: use
something secure and remember it. Your certificate will be useless without
it's corresponding key

2.   生成 CSR 文件 Generate the CSR 请使用以下命令来生成CSR Please type the following command at the prompt:

openssl req -new -key www.mydomain.com.key -out www.mydomain.com.csr

如果提示“Unable to load config info from /usr/local/ssl/openssl.cnf ”, 则加上一个指定openssl.cnf 路径的参数: openssl req -new -config openssl.cnf -key www.mydomain.com.key -out www.mydomain.com.csr

此命令将提示您输入X.509证书所要求的字段信息,包括国家(中国添CN)、省 份、所在城市、单位名称、单位部门名称(可以不填直接回车)。请注意: 除国 家缩写必须填CN外,其余都可以是英文或中文。

This command will prompt you for the X.509 attributes of your certificate. Enter your country, state or province and locality or city. You should enter the company name as it appears on your official company registration documents. The organization unit is optional, we verify and authenticate the company name and not the organization unit. To skip the organization unit (OU) field please press enter on your keyboard.

请输入您要申请SSL证书的域名,如果您需要为www.domain.com申请SSL证书 就不能只输入domain.com。SSL证书是严格绑定域名的。 The term "Common Name" is X.509 speak for the name that distinguishes the certificate best, and ties it to your Organization. Enter your exact host and domain name that you wish to secure. Example: If you wish to secure www.mydomain.com, then you will need to enter the exact host (www) and domain name (mydomain.com) in this field. If you enter mydomain.com then the certificate issued to you will only work error free on https://mydomain.com. It will cause a certificate mismatch error when you or your users access the domain via https:// www.mydomain.com.

注意: Common name 一定得写好 nihao.com 就不能是 www.nihao.com

请不要输入Email、口令(challenge password)和可选的公司名称,直接打回车 即可。 Please do not enter your email address, challenge password or an optional company name when generating the CSR.

您现在已经成功生成了密钥对,私钥文件:www.mydomain.com.key 保存在您的 服务器中, 请把CSR文件:www.mydomain.com.csr 发给Willrey/Thawte即可, CSR文件格式如下图所示。 You have now created a public/private key pair. The private key (www.mydomain.com.key) is stored locally on your machine and is used for decryption. The public portion is sent to thawte in the form of a Certificate Signing Request, and will be used by your users to encrypt the data they send to your site. The Certificate Signing Request (CSR) looks something like this:

openssl req -new -nodes -keyout myserver.key -out myserver.csr 或 openssl req -new -config openssl.cnf -nodes -keyout myserver.key -out myserver.csr

3.   备份私钥文件 Backup your private key

请备份您的私钥文件并记下私钥密码。最好是把私钥文件备份到软盘或光盘中。 Please backup your keystore file and make a note of the password. A good choice is to create a copy of this file onto a diskette or other removeable media.

完成之后 你就会受到 你购买的证书的机构发给你的确认邮件 里边就是你的 web server certificate 也就是接下来的 public .crt

二.

  Step 1: Save your SSL Certificate File

Firstly when your issuance email arrives it will contain your web server certificate. Copy your web server certificate into a text editor such as Notepad including the header and footer. You should then have a text file that looks like:

-----BEGIN CERTIFICATE-----

[encoded data]

-----END CERTIFICATE-----

Make sure you have 5 dashes to either side of the BEGIN CERTIFICATE and END CERTIFICATE and that no white space, extra line breaks or additional characters have been inadvertently added.

Save the certificate file as public.crt

Step 2: Obtain the Intermediate CA Bundle

Here is the intermediate file: intermediate_file (你网站的web certificate)

Right click the above intermediate_file link and save as intermediate.crt

Step 3: Set up your httpd.conf file

Open your httpd.conf file (some installations keep the SSL section separately in the ssl.conf file or separate ) using a text editor, and locate the virtual host section for the site for which the SSL Certificate will secure.

Your virtual host section will need to contain the following directives:

SSLCertificateFile – This will need to point to the your SSL certificate itself that we issued to you
SSLCertificateKeyFile – This will need to point to the private key file associated with your certificate.
SSLCertificateChainFile – This will need to point to the the intermediate file

Note: Some versions of Apache will not accept the SSLCACertificateFile directive. Try usingSSLCertificateChainFile instead.

For example

Save the changes to the file and quit the text editor

Stop and start apache to register the change.

Note: Some instances of Apache contain both a httpd.conf and ssl.conf file. Please enter or amend the httpd.conf or the ssl.conf with the above directives. Do not enter both as there will be a conflict and Apache may not start.

Additional information
The VirtualHosts in your httpd.conf file should be configured as follows:
<VirtualHost [IP ADDRESS]:443>
ServerAdmin admin@domain.com
DocumentRoot /www/home
ServerName www.domain.com
ErrorLog /www/home/logs/error_log
SSLEngine on
SSLProtocol all
SSLCertificateFile /etc/httpd/conf/ssl.crt/public.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/private.key
SSLCACertificateFile /usr/local/ssl/crt/intermediate.crt
ServerPath /home
<Directory "/www/home">
</Directory>
</VirtualHost>
Save your config file and restart Apache. You can most likely do so by using the apachectl script:
apachectl stop
几个注意事项:
1.http.conf 中 要include 你的httpd-ssl.conf 否则不生效。
2.http-ssl.conf 中要 loadmodoule ssl_module xx/mod_ssl.so
3.在 <virtual host>标签外 加上 SSLFIPS on
4.假如找不到private key 可以 用 openssl rsa -in xx.key -out private.key 然后放到httpd-ssl.conf
下面替换掉就好了。
5.必须保证apache编译的时候 --enable--ssl --with-ssl=openssl所在的目录

转载于:https://my.oschina.net/u/937153/blog/144189

相关文章:

C/C++中“#”和“##”的作用和用法

在C/C的宏中&#xff0c;”#”的功能是将其后面的宏参数进行字符串化操作(Stringfication)&#xff0c;简单说就是在对它所引用的宏变量通过替换后在其左右各加上一个双引号。而”##”被称为连接符(concatenator)&#xff0c;用来将两个子串Token连接为一个Token。注意这里连接…

国贫县山西永和:“一揽子”保险“保”脱贫

永和是吕梁山特困连片地区的深度贫困县&#xff0c;生产生活条件极差。 范丽芳 摄 永和是吕梁山特困连片地区的深度贫困县&#xff0c;生产生活条件极差。 范丽芳 摄 中新网太原1月16日电 题&#xff1a;国贫县山西永和&#xff1a;“一揽子”保险“保”脱贫 作者范丽芳 李海金…

内存泄漏检测工具VLD在VS2010中的使用举例

Visual LeakDetector(VLD)是一款用于Visual C的免费的内存泄露检测工具。它的特点有&#xff1a;(1)、它是免费开源的&#xff0c;采用LGPL协议&#xff1b;(2)、它可以得到内存泄露点的调用堆栈&#xff0c;可以获取到所在文件及行号&#xff1b;(3)、它可以得到泄露内存的完整…

天下武功,唯快不破,论推荐系统的“实时性”

作者 | 王喆转载自知乎王喆的机器学习笔记导读&#xff1a;周星驰著名的电影《功夫》里面有一句著名的台词——“天下武功&#xff0c;无坚不摧&#xff0c;唯快不破”。如果说推荐系统的架构是那把“无坚不摧”的“玄铁重剑”&#xff0c;那么推荐系统的实时性就是“唯快不破”…

新疆兵团开展迎新春“送文化下基层”慰问演出活动

演员表演舞蹈。 戚亚平 摄 演员表演舞蹈。 戚亚平 摄演员表演豫剧《花木兰》选段。 戚亚平 摄为物业公司员工送春联。 戚亚平 摄公安民警收到春联后留影。 戚亚平 摄走进退休职工家中表演节目。 戚亚平 摄为退休职工送春联。 戚亚平 摄 1月16日&#xff0c;2019年迎新春新疆生产…

Python爬取B站5000条视频,揭秘为何千万人为它流泪

作者 | Yura编辑 | 胡巍巍来源 | CSDN&#xff08;ID&#xff1a;CSDNnews&#xff09;导语&#xff1a;我们特邀作者Yura爬取B站5000条视频&#xff0c;为你揭秘电影《哪吒》的更多“优秀梗”&#xff0c;看完还能Get新技能&#xff0c;赶快往下滑吧。这个夏天&#xff0c;《哪…

父域与子域之的信任关系

搭了一个测试环境&#xff0c;做一个父、子域间信任关系的测试&#xff0c;过程如下&#xff1a;两台测试服务器&#xff0c;主域为primary.com&#xff0c;子域为child.primary.com客户机Clientpri加入父域&#xff0c;客户机Clientcli加入子域&#xff0c;父域中有一个用户为…

Ubantu安装maven

2019独角兽企业重金招聘Python工程师标准>>> 一、下载maven http://maven.apache.org/download.cgi 二、解压到指定目录 tar -xvf apache-maven-3.6.0-bin.tar.gz 三、添加环境变量 cd /etc vi profile 向其中添加 export M2_HOMEmaven所在目录 export M2$M2_HOME/b…

Leptonica在VS2010中的编译及简单使用举例

在tesseract-ocr中会用到leptonica库&#xff0c;这里对leptonica简单介绍下。Leptonica是一个开源的图像处理和图像分析库&#xff0c;它的license是BSD 2-clause。它主要包括的操作有&#xff1a;位图操作、仿射变换、形态学操作、连通区域填充、图像变换及像素掩模、融合、增…

IJCAI 2019精选论文一览,从底层到应用都有了

作者 | 神经小姐姐来源 | HyperAI超神经&#xff08;ID: HyperAI&#xff09;导语&#xff1a;为期一周的 IJCAI 第一天议程已经圆满结束。在前三天的工作坊上&#xff0c;全球各地人工智能行业人士&#xff0c;在此讨论 AI 在各个领域与方向的最新研究成果与未来动向。超神经特…

UITableView 添加长按手势UILongPressGestureRecognizer

2019独角兽企业重金招聘Python工程师标准>>> 给UITableView 添加长按手势&#xff0c;识别长按哪一行。 长按手势类UILongPressGestureRecognizer&#xff0c; 属性minimumPressDuration表示最短长按的时间 添加手势代码&#xff1a; UILongPressGestureRecogniz…

像我这种垃圾学校出来的人...【原话,不是我编的】

今天这标题&#xff0c;是咱们先行者课程的学生的原话&#xff0c;不是我编的&#xff0c;咱有截图为证&#xff0c;我这没别的意思&#xff0c;就是想说一下我自己的想法&#xff0c; 这种情况怎么办呢&#xff1f;也得生活啊&#xff0c;对吧&#xff0c;也不能人人都上清华北…

二维码Data Matrix简介及在VS2010中的编译

Data Matrix 二维条码原名Datacode&#xff0c;由美国国际资料公司(International Data Matrix, 简称ID Matrix)于1989年发明。Data-Matrix二维条码是一种矩阵式二维条码。Data Matrix符号由规则排列的深浅色正方形模块构成&#xff0c;每个正方形模块就是一个基本单元&#x…

一、数据库设计与性能优化--概述

前言我1998年第一次接触SQL Server 6.5 for Windows NT 4.0&#xff0c;当时的感觉就认为SQL Server只是一个功能强大的Excel文件。现在回想起来&#xff0c;当年抱着这样一种态度&#xff0c;我开发的那些应用程序应该是非常幼稚的&#xff0c;其性能可想而知。记得那时候随便…

第四范式戴文渊:AI落地,为什么不能照搬教科书?

“年少成名”、“天才”&#xff0c;在中国 AI 行业里用这两个词同时形容一个人的牛人不多&#xff0c;第四范式创始人戴文渊位列其中。在上海交通大学就读本科期间&#xff0c;戴文渊就带领三人团队夺得了 2005 年 ACM 的世界冠军和三个亚洲冠军&#xff0c;并担任ACM竞赛教练…

Kong Api 网关使用 docker 部署

Kong 镜像: https://hub.docker.com/_/kong 官网给定的用户安装手册上并没有设置 PG 的密码&#xff0c;导致如下问题无法启动 nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:277: [PostgreSQL error] failed to >retrieve server_version_num…

Windows7中搭建Android x86_64及armv8-a操作步骤

1. 从https://developer.android.com/tools/sdk/ndk/index.html 下载android-ndk-r10d-windows-x86_64.exe 和 android-ndk-r10d-linux-x86_64.bin&#xff1b; 2. 在Ubuntu1404 64位中通过终端安装ndkr10d&#xff1a;./android-ndk-r10d-linux-x86_64.bin ; 3.…

ContentResolver.query()—buildQueryString()

Cursor cursor context.getContentResolver().query(Sms.CONTENT_URI, new String[]{"thread_id from sms where type 3 group by thread_id—"}, // 可以这样使用。 null, null, null); 07-17 10:55:17.084: E/AndroidRuntime(30157): FATAL EX…

Room Database完全使用手册

前言 Android数据持久层直接使用SQLite很麻烦&#xff0c;Google官方推出了Room&#xff0c; Google对Room的定义&#xff1a; The Room persistence library provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of …

wiki的使用

Wiki一词来源于夏威夷语的”weekee wee kee”&#xff0c;被译为”维基”或”维客”。Wiki是一种多人协作的写作编辑平台。在Wiki网站上&#xff0c;访问者可以修改、完善已经存在的页面&#xff0c;或者创建新内容。 可以利用”维基百科&#xff1a;沙盒”来练习如何编辑&…

GAMIT安装备忘

2019独角兽企业重金招聘Python工程师标准>>> 系统环境&#xff1a; VMware Workstation9 ubuntu 10.04 操作 1.安装VMware Workstation 参考&#xff1a; VMware Workstation下载&#xff1a;http://pan.baidu.com/share/link?shareid407480&uk258569718…

FreeType简介及在vs2010的编译使用

FreeType库是一个开源、高质量、可扩展、可定制、可移植的字体引擎&#xff0c;它提供统一的接口来访问多种字体格式文件&#xff0c;包括点阵字、TrueType、OpenType、Type1、CID、CFF、Windows FON/FNT、X11 PCF等。 FreeType有两个License&#xff0c;一个是BSD-stype&…

firefox下的调试工具

2019独角兽企业重金招聘Python工程师标准>>> vue-devtools https://addons.mozilla.org/en-US/firefox/user/13100848/ 转载于:https://my.oschina.net/u/3371661/blog/3003299

NLP为RPA带来了什么价值?

什么是 RPA&#xff08;Robotic Process Automation&#xff09;&#xff1f;机器人流程自动化&#xff08;RPA&#xff09;是一种自动化工具&#xff0c;用于创建软件机器人的虚拟劳动力&#xff0c;从而优化和降低企业中端到端业务流程的成本。RPA 可以翻译成机器人流程自动化…

从原理到代码,轻松深入逻辑回归模型!

整理 | Jane出品 | AI科技大本营&#xff08;ID&#xff1a;rgznai100&#xff09;【导语】学习逻辑回归模型&#xff0c;今天的内容轻松带你从0到100&#xff01;阿里巴巴达摩院算法专家、阿里巴巴技术发展专家、阿里巴巴数据架构师联合撰写&#xff0c;从技术原理、算法和工程…

JVM内存管理学习总结(一)

I.JVM进程的生命周期 JVM实例的生命周期和java程序的生命周期保持一致&#xff0c;即一个新的程序启动则产生一个新的JVM进程实例&#xff0c;程序结束则JVM进程实例伴随着消失。那么程序启动和程序终止就是JVM实例生命周期的两个边界&#xff0c;两个边界点可以这么理解&#…

开源库Simd在vs2010中的编译及简单使用

Simd是开源的图像处理库&#xff0c;它提供了很多高性能的算法&#xff0c;这些优化算法主要由SIMD指令来实现&#xff0c;包括SSE、SSE2、SSSE3、SSE4.1、SSE4.2、AVX等&#xff0c;此库可以应用在windows/linux 32bit/64bit等系统中。此库更新较频繁。此库的license是MIT。下…

Dubbo2.6.5+Nacos注册中心(代替Zookeeper)

在上一节的小栗子的基础上&#xff0c;只需要更改两个地方 第一个&#xff1a;父工程的pom依赖增加 <!-- Dubbo Nacos registry dependency --><dependency><groupId>com.alibaba</groupId><artifactId>dubbo-registry-nacos</artifactId>…

Nginx(二) 配置与调试

nginx 主配置文件在安装目录下的conf中&#xff0c;名字为nginx.conf&#xff1a;主配置文件主要分为4部分&#xff1a;main&#xff08;全局设置&#xff09;、server&#xff08;主机设置&#xff09;、upstream&#xff08;负载均衡服务器设置&#xff09;和location&#x…

AI编程语言图鉴

作者 | 元宵大师责编 | 胡巍巍来源 | CSDN&#xff08;CSDNnews&#xff09;当前最炙手可热的领域非“人工智能”&#xff08;Artificial Intelligence&#xff09;莫属。其实&#xff0c;“人工智能”的火热并非一蹴而就&#xff0c;早在1956年“人工智能”概念就已经被提出了…