假设apache已经装好

1、使用yum install openssl,安装openssl

2、开启httpd.conf中LoadModule ssl_module modules/mod_ssl.so

3、制作证书

有一个工具可以使用:http://www.openssl.org/contrib/ssl.ca-0.1.tar.gz  。下面是如何通过这个工具来生成证书的过程:

#cp ssl.ca-0.1.tar.gz /usr/local/apache/httpd/conf
#cd /usr/local/apache/conf
#tar zxvf ssl.ca-0.1.tar.gz
#cd ssl.ca-0.1
#./new-root-ca.sh (生成根证书)
No Root CA key round. Generating one
Generating RSA private key, 1024 bit long modulus
...........................++++++
....++++++
e is 65537 (0x10001)
Enter pass phrase for ca.key: (输入一个密码)
Verifying - Enter pass phrase for ca.key: (再输入一次密码)
......
Self-sign the root CA... (签署根证书)
Enter pass phrase for ca.key: (输入刚刚设置的密码)
........
........ (下面开始签署)
Country Name (2 letter code) [MY]:CN
State or Province Name (full name) [Perak]:GanSu//随你喜欢
Locality Name (eg, city) [Sitiawan]:LanZhou//随你喜欢
Organization Name (eg, company) [My Directory Sdn
Bhd]:lzu//随你喜欢
Organizational Unit Name (eg, section) [Certification Services
Division]:lzu//随你喜欢
Common Name (eg, MD Root CA) []:dslab//随你喜欢
Email Address []:sunyanmeng@gmail.com//随你喜欢
这样就生成了ca.key和ca.crt两个文件,下面还要为我们的服务器生成一个证书:
# ./new-server-cert.sh server (这个证书的名字是server)
......
......
Country Name (2 letter code) [MY]:CN
State or Province Name (full name) [Perak]:GanSu
Locality Name (eg, city) [Sitiawan]: LanZhou
Organization Name (eg, company) [My Directory Sdn Bhd]:lzu
Organizational Unit Name (eg, section) [Secure Web Server]:lzu
Common Name (eg, www.domain.com) []:localhost
Email Address []:sunyanmeng@gmail.com
这样就生成了server.csr和server.key这两个文件。
还需要签署一下才能使用的:
# ./sign-server-cert.sh server
CA signing: server.csr -> server.crt:
Using configuration from ca.config
Enter pass phrase for ./ca.key: (输入上面设置的根证书密码)
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'GanSu'
localityName :PRINTABLE:'LanZhou'
organizationName :PRINTABLE:'lzu'
organizationalUnitName:PRINTABLE:'lzu'
commonName :PRINTABLE:'localhost'
emailAddress  :IA5STRING:'sunyanmeng@gmail.com'
Certificate is to be certified until Jan 19 21:59:46 2011 GMT (365
days)
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
CA verifying: server.crt <-> CA cert
server.crt: OK

下面要按照ssl.conf里面的设置,将证书放在适当的位置。

# chmod 400 server.key
# cd ..
# mkdir ssl.key
# mv ssl.ca-0.1/server.key ssl.key
# mkdir ssl.crt
# mv ssl.ca-0.1/server.crt ssl.crt

4、配置ssl.conf(/etc/httpd/conf/ssl.conf)

打开ssl.conf文件

<VirtualHost *:443>

DocumentRoot "/var/www/html/"#你的WEB目录,和vhost里配置一样。
ServerName www.xxx.com:443

SSLCertificateFile /etc/httpd/conf.d/ssl.crt#你的文件在哪里就写哪里的路径

SSLCertificateKeyFile /etc/httpd/conf.d/ssl.key#你的文件在哪里就写哪里的路径

SSLCertificateChainFile /etc/httpd/conf.d/ca.crt#你的文件在哪里就写哪里的路径

</VirtualHost>

5、加载ssl的方式启动apache(这步很重要)

找到你的apachectl位置,

apachectl -D SSL -k start

apache 配置 SSL的更多相关文章

  1. window下为apache配置ssl证书

    转载自 子非鱼 的博客稍作修改 第一步:依赖 配置Apache服务器支持https协议和SSL证书,最基本的要求是Apache包含openssl模块.还好apache/bin目录下有libeay32. ...

  2. windows下Apache配置SSL安全连接

    什么是SSL? SSL(Secure Socket Layer): 是为Http传输提供安全的协议,通过证书认证来确保客户端和网站服务器之间的数据是安全.Open SSL下载地址:http://www ...

  3. windows下apache配置ssl(https)服务器

    SSl是为Http传输提供安全的协议,通过证书认证来确保客户端和网站服务器之间的数据是安全, 可以通过apache自带的openssl进行配置: 步骤如下: 1.安装有openssl模板的apache ...

  4. apache配置ssl

    1.确认是否安装ssl模块 是否有mod_ssl.so文件   2.生成证书和密钥   linux下 步骤1:生成密钥 命令:openssl genrsa 1024 > server.key 说 ...

  5. Apache 配置SSL网站

    1. 申请证书    现在可以在阿里云或七牛上申请免费的证书,这里以阿里云为例        进入阿里云证书申请界面    https://www.aliyun.com/product/cas     ...

  6. centos7 apache 配置ssl

    因为小程序后台服务器需要是https的,所以这两天赶紧百度了一波什么是https以及怎么将服务器升级为https.虽然网上教程很多但因具体环境可能有差异导致一路遇坑,摸爬滚打了两天终于弄好了.遂记下一 ...

  7. Linux下Apache配置SSL支持https

    参考:http://www.thinksaas.cn/group/topic/280017/ 生成证书过程如下 Step :生成服务器密钥: mkdir -p /etc/pki/test cd /et ...

  8. Appserv(Apache) 配置ssl证书

    一:打开httpd.conf文件,移除注释的行: Include conf/extra/httpd-ahssl.conf LoadModule ssl_module modules/mod_ssl.s ...

  9. 8-STM32物联网开发WIFI(ESP8266)+GPRS(Air202)系统方案安全篇(Apache 配置SSL,HTTPS连接)

    https://www.cnblogs.com/yangfengwu/p/10947423.html 和当时配置MQTT差不多,去下载证书文件   https://www.cnblogs.com/ya ...

随机推荐

  1. Delphi中DLL的创建和使用(转)

    Delphi中DLL的创建和使用     1.DLL简介:   2.调用DLL:   3.创建DLL:   4.两个技巧:   5.初始化:   6.例外处理.            1.DLL简介  ...

  2. 海康威视面试python后端题

    1. 请简述三次握手和四次挥手: 答:首先TCP是传输控制协议,提供可靠的连接服务,采用三次握手确认建立一个连接,在建立TCP连接时,需要客户端和服务器总共发送3个包. 三次握手的目的是连接服务器的指 ...

  3. Codeforces Round #460 (Div. 2): D. Substring(DAG+DP+判环)

    D. Substring time limit per test 3 seconds memory limit per test 256 megabytes input standard input ...

  4. POJ:3977-Subset(双向搜索)

    Subset Time Limit: 30000MS Memory Limit: 65536K Total Submissions: 5961 Accepted: 1129 Description G ...

  5. Hive数据导入导出的n种方式

    Tutorial-LoadingData Hive加载数据的6种方式 #格式 load data [local] inpath '/op/datas/xxx.txt' [overwrite] into ...

  6. 关于DIV内文字垂直居中的写法

    最近在写UI,或多或少用到了CSS,在这记录一下,今天用到的DIV内文字垂直居中的写法, 因为所做的项目都是基于WebKit内核浏览器演示的,所以我们今天采用的是-webkit-box的写法: dis ...

  7. android 文件下载 超简单

    public void downloadPlug(String downloadUrl,String savePath) { try { URL url = new URL(downloadUrl); ...

  8. 【转】灰色在PPT中的运用

    一.作为背景   灰色作为背景能够有效烘托其他元素,特别是与白/黑色渐变,效果更好.   1.黑灰渐变,科技感十足 2.纯灰:简单清晰 http://www.behance.net/gallery/N ...

  9. linux ubuntu 现在显示的是ubuntu login

    linux ubuntu 现在显示的是ubuntu login 如果要进图形界面,你需要安装桌面管理器sudo apt-get install ubuntu-desktop或sudo apt-get  ...

  10. python解析复杂json字符串

    因为项目需要,公司领导对提出了接口测试的要求,因此作为一个测试人员,我第一时间就想到了jmeter这个利器,前面文章也有说明过怎么用jmeter做http协议的接口测试,这里我不再做讲解,此篇主要讲解 ...