1、首先为192.168.108.159创建私有CA

#cd /etc/pki/CA

# (umask 077;openssl genrsa -out private/cakey.pem 2048)

#ls private/

#touch index.txt

#echo 01 > serial

2、在服务器上创建自签证书

#openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 7300

3、在web服务器上生成证书签署请求,在192.168.108.160虚拟机上

#cd /etc/httpd

#mkdir ssl

#cd ssl/

# (umask 077;openssl genrsa -out httpd.key 1024)//生成密钥

# openssl req -new -key httpd.key -out httpd.csr  //生成证书签署请求

#scp httpd.csr root@192.168.108.159:/tmp/  //把httpd.csr放到服务器192.168.108.159的tmp目录下

4、在服务器上为wei服务器CA签证

#cd /etc/pki/CA

#openssl ca -in /tmp/httpd.csr -out certs/web1.magedu.com.crt -days 356

#ls newcerts/  在这个目录下有01.pem

#ls certs/

#scp certs/web1.magedu.com.crt root@192.168.108.160:/etc/httpd/ssl/

5、接下来开始配置httpd服务可以支持https

#httpd -M | grep ssl   //查看160主机即httpd服务器是否支持mod_ssl

#yum install mod_ssl //如果不存在就安装

#rpm -ql mod_ssl

/etc/httpd/conf.d/ssl.conf  //主配置文件
/usr/lib64/httpd/modules/mod_ssl.so
/var/cache/mod_ssl
/var/cache/mod_ssl/scache.dir
/var/cache/mod_ssl/scache.pag
/var/cache/mod_ssl/scache.sem

#cd /etc/httpd/conf.d/

#cp ssl.conf{,.bak}//在修改配置文件之前应该先做备份

#vim /etc/httpd/conf.d/ssl.conf

修改<VirtualHost _default_:443>为<VirtualHost  *:443>

DocumentRoot "/var/www/html"//需要开启,并对其做响应的修改,比如/vhosts/web1/htdocs
ServerName www.example.com:443//   服务器名字为web1.magedu.com

SSLEngine on这一项一定要开启

修改SSLCertificateFile /etc/pki/tls/certs/localhost.crt为SSLCertificateFile /etc/httpd/ssl/web1.magedu.com.crt//这个文件是当前httpd服务拿来给别的客户机验证的证书文件

修改SSLCertificateKeyFile /etc/pki/tls/private/localhost.key与上面匹配的私钥文件SSLCertificateKeyFile /etc/httpd/ssl/httpd.key

不应该验证客户端证书,因为客户端大多都没有证书

#ss -tnl //查看是否监听了443端口

测试基于https访问相应的主机;

# openssl s_client [-connect host:port] [-cert filename] [-CApath directory] [-CAfile filename]

#openssl s_client  -connect 192.168.108.160:443 -CAfile /etc/pki/CA/cacert.pem

GET / HTTP/1.1

Host:web1.magedu.com回车两次,就可以看到请求的页面

配置httpd支持https的更多相关文章

  1. 配置nginx支持Https

    配置nginx支持Https一定要先使用stop停止nginx然后重新代开不能使用reload 一:安装letsencrypt 1.从git上克隆下来git clone https://github. ...

  2. 安装配置ingress-nginx支持https访问

    说明: ​ 1.k8s版本:v1.23: ​ 2.内网测试环境1台master,2台node节点,使用 DaemonSet+HostNetwork+nodeSelector 方式部署 ingress- ...

  3. Spring Mvc和Spring Boot配置Tomcat支持Https

    SpringBoot配置支持https spring boot因为是使用内置的tomcat,所以只需要一些简单的配置即可. 1.首先打开命令行工具,比如cmd,输入以下命令 keytool -genk ...

  4. Springboot 配置 ssl 实现HTTPS 请求 & Tomcat配置SSL支持https请求

    SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种安全协议.TLS与 ...

  5. centos7配置Apache支持HTTPS

    Apache版本2.4 安装mod_ssl yum install mod_ssl 建立文件夹,存放sslkey mkdir /etc/httpd/ssl/ 建立凭证档 openssl req -x5 ...

  6. Windows 下配置 Apache 支持 https

    1.打开cmd ,输入  F: // 切换到Apache安装路径,我的Apache安装目录在 F盘 2.cd F:\Apache\bin 3.set "openssl_conf = F:\A ...

  7. CentOS 中 配置 Nginx 支持 https

    一.基础设置: .yum -y update .yum -y install openssl* .cd /usr/local/nginx/conf .mkdir ./ssl .cd ./ssl # 在 ...

  8. apache环境下配置服务器支持https

    SSL加密的意义在于保护服务器到客户端的信息或者是客户端到服务器的信息不被监听和篡改. 现在一些主流的网站都已经是通过 https访问了,搜索引擎对此类网站的收录也不存在问题了. 具体的配置流程大概是 ...

  9. Centos7.2下Nginx配置SSL支持https访问(站点是基于.Net Core2.0开发的WebApi)

    准备工作 1.基于nginx部署好的站点(本文站点是基于.Net Core2.0开发的WebApi,有兴趣的同学可以跳http://www.cnblogs.com/GreedyL/p/7422796. ...

随机推荐

  1. hive 实现一个字段多行转一行 和 一行转多行

    1.多行转一行 多行转一行可以通过concat_ws(',',collect_set(col_name)) as col_new的方式实现,可以参考:https://www.cnblogs.com/s ...

  2. DataX介绍

    一. DataX3.0概览 DataX 是一个异构数据源离线同步工具,致力于实现包括关系型数据库(MySQL.Oracle等).HDFS.Hive.ODPS.HBase.FTP等各种异构数据源之间稳定 ...

  3. linux下安装mysql(rpm文件安装)

    数据库包下载: https://www.mysql.com/downloads/ 在GPL开原协议的社区开源版里边下载 我们用mysql community server里边的 其中workbench ...

  4. PNG文件格式详解

    源文件地址:https://blog.mythsman.com/2015/12/08/1/ 最近在看隐写术的时候经常需要研究图片文件的二进制文档格式,那么这就很有必要了解我们的图片文件究竟是如何保存的 ...

  5. GUI保存打开对话框

    %uigetfile uigetfile doc uigetfile %规定打开文件类型 uigetfile('*.m'); %输出参数意义 [a,b,c] = uigetfile('*.m');%a ...

  6. TensorFlow 分布式实践

    此wiki主要介绍分布式环境使用的一些条件,一直所要注意的内容: 确保在此之前阅读过TensorFlow for distributed 1.集群描述 当前tensorflow 的版本(0.8.0), ...

  7. easyui dialog 表单提交,弹框初始化赋值,dialog实现

    //定义弹框html<div id="delete" class="easyui-dialog" title="Delete" dat ...

  8. 安装ubuntu18.04.1

    下载ubuntu:https://www.ubuntu.com/download/desktop 在虚拟机创建好ubuntu18.04.1后无法启动(选择的是linux,ubuntu64位),提示:此 ...

  9. 【新架构测试】Fiddler转发数据测试

    跨域转发设置: 首先进行设置, AutoResponder--> 选中Enable rules和Unmatched requests passthrough 然后Import...导入fiddl ...

  10. 最简单的uwsgi+nginx配置多个django站点

    1. nginx.conf http{ server { listen       80; server_name  www.web1.com ....... location / { uwsgi_p ...