配置httpd支持https
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的更多相关文章
- 配置nginx支持Https
配置nginx支持Https一定要先使用stop停止nginx然后重新代开不能使用reload 一:安装letsencrypt 1.从git上克隆下来git clone https://github. ...
- 安装配置ingress-nginx支持https访问
说明: 1.k8s版本:v1.23: 2.内网测试环境1台master,2台node节点,使用 DaemonSet+HostNetwork+nodeSelector 方式部署 ingress- ...
- Spring Mvc和Spring Boot配置Tomcat支持Https
SpringBoot配置支持https spring boot因为是使用内置的tomcat,所以只需要一些简单的配置即可. 1.首先打开命令行工具,比如cmd,输入以下命令 keytool -genk ...
- Springboot 配置 ssl 实现HTTPS 请求 & Tomcat配置SSL支持https请求
SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种安全协议.TLS与 ...
- centos7配置Apache支持HTTPS
Apache版本2.4 安装mod_ssl yum install mod_ssl 建立文件夹,存放sslkey mkdir /etc/httpd/ssl/ 建立凭证档 openssl req -x5 ...
- Windows 下配置 Apache 支持 https
1.打开cmd ,输入 F: // 切换到Apache安装路径,我的Apache安装目录在 F盘 2.cd F:\Apache\bin 3.set "openssl_conf = F:\A ...
- CentOS 中 配置 Nginx 支持 https
一.基础设置: .yum -y update .yum -y install openssl* .cd /usr/local/nginx/conf .mkdir ./ssl .cd ./ssl # 在 ...
- apache环境下配置服务器支持https
SSL加密的意义在于保护服务器到客户端的信息或者是客户端到服务器的信息不被监听和篡改. 现在一些主流的网站都已经是通过 https访问了,搜索引擎对此类网站的收录也不存在问题了. 具体的配置流程大概是 ...
- Centos7.2下Nginx配置SSL支持https访问(站点是基于.Net Core2.0开发的WebApi)
准备工作 1.基于nginx部署好的站点(本文站点是基于.Net Core2.0开发的WebApi,有兴趣的同学可以跳http://www.cnblogs.com/GreedyL/p/7422796. ...
随机推荐
- 使用函数接口和枚举实现配置式编程(Java与Scala实现)
概述 做报表时,有时需要根据不同的业务生成不同的报表.这样,需要能够动态地配置列字段,并根据列字段来输出对应的报表.使用函数接口结合枚举可以比较优雅地实现配置式编程. 问题描述如下: 假设有对象 St ...
- AtCoder Beginner Contest 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There is a hotel with ...
- Python+OpenCV图像处理(七)—— 滤波与模糊操作
过滤是信号和图像处理中基本的任务.其目的是根据应用环境的不同,选择性的提取图像中某些认为是重要的信息.过滤可以移除图像中的噪音.提取感兴趣的可视特征.允许图像重采样等等.频域分析将图像分成从低频到高频 ...
- 使用tableau去将存入mysql都地区点击率进行了展示 感觉很好用
1.连接数据源很多选项:hive mysql Oracle 等所有数据库 2.写上hive2的那个客户端连接,下边会显示出让我装连接的驱动 ,所有jdbc都需要这样 点进去找到windows的下载一键 ...
- PHP 支付类库, cURL开源HTTP类库
未做任何测试 支付类库地址:http://doc.yurunsoft.com/PaySDK cURL开源HTTP类库地址:http://doc.yurunsoft.com/YurunHttp/1
- ElasticSearch(二)CentOs6.4下安装ElasticSearch
一.准备工作 Elastic 需要 Java 8 环境.如果你的机器还没安装 Java,先需要安装java环境,同时还注意要保证环境变量JAVA_HOME正确设置. 链接:https://pan.ba ...
- Mysql安装错误:Install/Remove of the Service Denied!解决办法
Mysql安装错误:Install/Remove of the Service Denied!解决办法 在windos 的cmd下安装mysql 在mysql的bin目录下面执行: mysqld -- ...
- win7使用问题解决
1. VM和主机互相PING不通 问题:桥接模式,VM可以ping 通外网,可以ping 通局域网其它机子,就是ping 不通本地主机 解决:将 vm网卡和本地网连接网卡都共享出来
- answerOpenCV轮廓类问题解析
contour在opencv中是一个基础的数据结构,灵活运用的话,作用很大.以contour为关键字,在answerOpenCV中能够发现很多有趣的东西. 1.无法解决的问题 http://answe ...
- Building a Keras + deep learning REST API(三部曲之一)
一.基本环境 ) image = imagenet_utils.preprocess_input(image) , )) ]: ...