没有安装apache的情况:

首先安装SSL,再编译安装Apache,再配置证书即可

1.下载apache和openssl

网址:http://www.apache.org

http://www.openssl.org

2.解压

(先进入到安装包的位置,和你解压的文件名字是不是和这个一样)

#tar zxvf httpd-2.0.54.tar.gz

#tar zxvf openssl-0.9.7g.tar.gz

3.编译安装openssl,这个软件主要是用来生成证书:

#cd openssl-0.9.7g

#./config

#make

#make test

#make install

把openssl放进内核目录下,使其在任何目录下都能运行。

#cd /usr/local/bin

#ln -s /usr/local/ssl/bin/openssl openssl

4.编译安装httpd

#cd /opt/httpd-2.0.54

#./configure --prefix="/opt/apache2" --enable-so --enable-ssl --with-ssl="/usr/local/ssl/bin"

#make

#make install

5.安装完毕,生成证书:

在/opt/apache2/conf下建立一个ssl.key目录

#cd ../apache2/

#cd conf/

#mkdir ssl.key

然后在该目录下生成证书:

#cd ssl.key/

生成服务器私钥:

#openssl genrsa -des3 -out server.key 1024

Generating RSA private key, 1024 bit long modulus

.......................++++++

.................................................++++++

e is 65537 (0x10001)

Enter pass phrase for server.key:

Verifying - Enter pass phrase for server.key:

生成服务器证书请求,并按要求填些相关证书信息:

#openssl req -new -key server.key -out server.csr

如果要生成中文证书用

#openssl req -utf8 -new -key server.key -out server.csr

Enter pass phrase for server.key:

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) [AU]:

State or Province Name (full name) [Some-State]:

Locality Name (eg, city) []:tyl

Organization Name (eg, company) [Internet Widgits Pty Ltd]:tz

Organizational Unit Name (eg, section) []:tz

Common Name (eg, YOUR name) []:tyl(这个名字要和计算机的名字一样)

Email Address []:tangyl@ruyi.com

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

签证:

# openssl x509 -req -days 700 -in server.csr -signkey server.key -out server.cert

Signature ok

subject=/C=AU/ST=Some-State/L=tyl/O=tz/OU=tz/CN=tyl/emailAddress=tangyl@ruyi.com

Getting Private key

Enter pass phrase for server.key:

为了安全,然后我们把这些文件的权限都设为400

chmod 400 server.key

chmod 400 server.cert

最后对/opt/apache2/conf/ssl.conf 进行修改:

vi /opt/apache2/conf/ssl.conf

修改的地方如下几处:

#SSLCertificateFile /opt/apache2/conf/ssl.crt/server.crt #108行

SSLCertificateFile /opt/apache2/conf/ssl.key/server.cert

#SSLCertificateFile /opt/apache2/conf/ssl.crt/server-dsa.crt

SSLCertificateKeyFile /opt/apache2/conf/ssl.key/server.key   #116行

#SSLCertificateKeyFile /opt/apache2/conf/ssl.key/server-dsa.key

这样我们就基本配好了ssl现在我们来让apache启动ssl

/opt/apache2/bin/apachectl startssl

然后要求输入证书密码,正确输入后ssl就连同apache一起启动

已经安装apache的情况:

必须先在Linux下安装apache 服务

执行:                 yum install mod_ssl

就会出现:Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package mod_ssl.i386 1:2.2.3-31.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
mod_ssl i386 1:2.2.3-31.el5 file 88 k

Transaction Summary
====================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 88 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mod_ssl 1/1

Installed:
mod_ssl.i386 1:2.2.3-31.el5

Complete!

然后手动创建证书:

cd /etc/pki/tls/certs/

make auth.key (创建一个名为auth的SSL私钥)
umask 77 ; \
/usr/bin/openssl genrsa -des3 1024 > auth.key
Generating RSA private key, 1024 bit long modulus
……………………………….++++++
……………………….++++++
e is 65537 (0×10001)
Enter pass phrase:
Verifying – Enter pass phrase:

[root@localhost certs]# make auth.crt (创建一个名为auth的证书)
umask 77 ; \
/usr/bin/openssl req -new -key auth.key -x509 -days 365 -out auth.crt -set_serial 0
Enter pass phrase for auth.key: (输入刚才的私钥密码)
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) [GB]:CN (国家)
State or Province Name (full name) [Berkshire]:liaoning (地区)
Locality Name (eg, city) [Newbury]:dalian (城市)
Organization Name (eg, company) [My Company Ltd]:IBM (组织机构名)
Organizational Unit Name (eg, section) []:IBM (全名)
Common Name (eg, your name or your server’s hostname) []:WWW.IBM.COM (公共名称)
Email Address []: (邮箱)

8.再次重新配置我们的httpd

在/usr/local/apache2/conf/httpd.conf里面做下面修改

1) LoadModule ssl_module /etc/httpd/modules/mod_ssl.so(加上这句)

Include conf/extra/httpd-ssl.conf 去掉两行前面的#

2)注意修改httpd-ssl.conf 文件里的两个字段:

SSLCertificateFile /etc/pki/tls/certs/auth.crt
SSLCertificateKeyFile /etc/pki/tls/private/auth.key

这样我们就基本配好了ssl现在我们来让apache启动ssl

/usr/local/apache2/bin/apachectl start

然后要求输入证书密码,正确输入后ssl就连同apache一起启动

这次我输入的密码都是:123456,只要不混淆的情况下你可以随便设置。

自 己看法:我觉得进去的时候先检查httpd.conf然后就会启动一些配置,我们的设置就会生效。这个方案最红使用的是apache自带的mod_SSL 的模块,并没有使用openssl的加密过程,但是第一种方案使用的是openssl,具体过程可能比较复杂,不知道怎么实现的。上面的一些步骤可能有些 多余,但是我在原理方面不太清楚,所以就不知道那些该删,那些该留。

转载于:https://www.cnblogs.com/xingmeng/p/3252916.html

Linux下配置SSL (转)相关推荐

  1. linux 怎么配置apache,在Linux下配置Apache Web服务

    <在Linux下配置Apache Web服务>由会员分享,可在线阅读,更多相关<在Linux下配置Apache Web服务(10页珍藏版)>请在人人文库网上搜索. 1.在Lin ...

  2. linux下配置mysql默认编码utf8

    linux下配置mysql默认编码utf8 下面是需要在对应地方加入的配置 [client] default-character-set=utf8[mysqld] character-set-serv ...

  3. Linux下配置jupyter notebook远程访问实战:配置Jupyter的连接密码、启动jupyter服务、远程访问jupyter(关闭防火墙)

    Linux下配置jupyter notebook远程访问实战:配置Jupyter的连接密码.启动jupyter服务.远程访问jupyter(关闭防火墙) 目录 Linux下配置jupyter note ...

  4. linux tomcat 安装教程,关于Linux下配置安装Tomcat8的步骤

    由于Centos6即将停止更新,本次就使用Centos7.5 X64位系统来演示,Tomcat版本就使用8.5,如果想使用9.0的版本也可以去官网进行下载,步骤都大同小异. 关于Tomcat9的新特性 ...

  5. 在Linux 下配置PHP 支援GD

    本站的另一篇文章介绍了在Linux 下配置PHP + MySQL 的执行环境,而照着该篇文章安装的PHP 是未能支援GD 的. 而本文就是介绍在Linux 下安装GD,并配置PHP 支援GD. GD ...

  6. linux下配置 ITK

    在 linux 下配置 ITK 在 linux 下配置 ITK 1. 下载 CMake:http://www.cmake.org/cmake/resources/software.html 为方便安装 ...

  7. proc除了能用于oracle开发_能不能用于mysql开发_Oracle数据库开发(二).Linux下配置使用ProC...

    一.提要 上文简单介绍了Windows下ProC配置开发,这次我们使用Linux平台再次配置Oracle ProC开 发环境(RedHat Linux 9 + Oracle 92). <ORAC ...

  8. linux c 下信号量 windows下event_windows和linux下配置jdk环境

    一 在linux 下配置jdk 环境 ① 在官网下载安装包,这里如何下载安装包就不一一叙述,下载安装包完成后,使用rz命令上传至linux中.提前在linux中建立一个文件夹 mkdir /usr/l ...

  9. Linux下配置Smba服务器

    文章目录 1 Linux下配置Smba服务器 1 Linux下配置Smba服务器 Ubuntu安装Samba 服务器: 确认安装: dpkg -l | grep samba 安装: sudo apt- ...

最新文章

  1. JFinal 源码build脚本
  2. python中停车收费问题_使用CKRule实现停车场收费计算
  3. 自定义ProgressBar(自定义View和ClipDrawable)
  4. 企业网站SEO优化如何做引流并促进转化?
  5. 下列关于php说法错误的,PHP试题
  6. 从Q4财报,看有道如何实现从在线教育“迷途”中脱身?
  7. No Architectures to Compile for (ONLY_ACTIVE_ARCH=
  8. Codeforces Global Round 12 E. Capitalism 差分约束
  9. skimage直方图如何保存_LightGBM的参数详解以及如何调优
  10. qt布局嵌套_QDockWidget嵌套布局详解-实现Visual Studio布局
  11. Redis 常用配置参数
  12. 京东方将首次向华为供应on-cell OLED面板 用于Mate 40系列
  13. 查看工作组计算机没有服务器,计算机相关:网上邻居问题:当前工作组的服务器列表无法使用...
  14. java中自定义异常的方法步骤
  15. SQL Server智能提示插件下载
  16. fastdfs的tracker启动之后一直选举_Elasticsearch选举流程详解
  17. 6.2 数据通路的建立
  18. 一口一口吃掉Struts(六)——动态ActionForm
  19. etree解析xml_在python中使用Etree解析XML配置文件
  20. Teamviewer远程工具使用

热门文章

  1. Java方法,调用,static关键字
  2. 三目运算符引发的一次事故
  3. redis3.0.0 集群安装详细步骤
  4. 在linux 下怎么查看服务器的cpu和内存的硬件信息
  5. iOS App上架流程(2016详细版)
  6. ORA-600 [kddummy_blkchk] [18038] 一例
  7. 三分钟学会《门面模式》
  8. Android 中 include的使用
  9. 解决MySQL自动断开连接的问题
  10. 浅谈算法和数据结构: 五 优先级队列与堆排序