当前位置: 首页 > news >正文

在Apache HTTP服务器上配置 TLS加密

  1. 安装mod_ssl软件包
[root@localhost conf.d]# dnf install mod_ssl -y

此时查看监听端口多了一个443端口
在这里插入图片描述

  1. 自己构造证书
[root@localhost conf.d]# cd /etc/pki/tls/certs/
[root@localhost certs]# openssl genrsa > jiami.key
[root@localhost certs]# openssl req -utf8 -new -key jiami.key -x509 -days 100 -out jiami.crt
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) [XX]:86
State or Province Name (full name) []:shaaxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:rhce
Organizational Unit Name (eg, section) []:peihua
Common Name (eg, your name or your server's hostname) []:www.hehe.com
Email Address []:admin@hehe.com
[root@localhost certs]# mv jiami.key ../private/
[root@localhost certs]# cd -
/etc/httpd/conf.d
[root@localhost conf.d]# ll
total 32
-rw-r--r--. 1 root root 2916 Jul 20  2023 autoindex.conf
-rw-r--r--. 1 root root  400 Jul 20  2023 README
-rw-r--r--. 1 root root 8720 Jul 20  2023 ssl.conf
-rw-r--r--. 1 root root 1252 Jul 20  2023 userdir.conf
-rw-r--r--. 1 root root 1171 Jul  5 15:41 vhost.conf
-rw-r--r--. 1 root root  653 Jul 20  2023 welcome.conf

修改配置文件

[root@localhost conf.d]# vim ssl.conf 

在这里插入图片描述
重启服务

[root@localhost conf.d]# systemctl restart httpd

测试
在这里插入图片描述

  1. 在vhost.conf配置文件中添加信息

在这里插入图片描述

  1. 测试
    之前在/www/hehe/index.html里写的东西现在还都能访问,证书也构造成功。
    在这里插入图片描述在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在本地访问需要在本地解析文件中添加www.hehe.com主机名

[root@localhost conf.d]# vim /etc/hosts

在这里插入图片描述

[root@localhost conf.d]# curl -k https://www.hehe.com
welcome to hehe
http://www.lryc.cn/news/392351.html

相关文章:

  • C语言力扣刷题11——打家劫舍1——[线性动态规划]
  • 房屋租赁管理小程序的设计
  • oracle sql语句 排序 fjd = ‘0101‘ 排在 fjd = ‘0103‘ 的前面
  • 初试成绩占比百分之70!计算机专硕均分340+!华中师范大学计算机考研考情分析!
  • 【面向就业的Linux基础】从入门到熟练,探索Linux的秘密(十)-git(2)
  • JMH320【亲测】【御剑九歌】唯美仙侠手游御剑九歌+WIN学习手工端+视频教程+开服清档+运营后台+授权GM物品充值后台
  • 【matlab】信号分解/故障诊断——智能优化算法优化VMD
  • 【重磅】万能模型-直接能换迪丽热巴的模型
  • Web基础和HTTP协议
  • Mini-L-CTF-2022 minispringboot Thymeleaf模板注入 spel的绕过
  • LLM - 神经网络的组成
  • C++:拷贝构造函数
  • 云服务出现故障这样处理
  • CVPR2024自动驾驶轨迹预测方向的论文整理
  • 数据结构——队列练习题
  • PLL和CDR的内部结构及其区别
  • HarmonyOS APP应用开发项目- MCA助手(Day02持续更新中~)
  • 华为交换机 LACP协议
  • node 下载文件到网络共享目录
  • STM32基础知识
  • 安装docker版rabbitmq 3.12
  • c++重定向输出和输出(竞赛讲解)
  • 实在智能对话钉钉:宜搭+实在Agent,AI时代的工作方式
  • MySQL的Docker部署方式
  • 光伏电站数据采集方案(基于工业路由器部署)
  • 一文让你彻底搞懂什么是CDN
  • 1023记录
  • 【并发编程JUC】AQS详解
  • 如何找BMS算法、BMS软件的实习
  • AR视频技术与EasyDSS流媒体视频管理平台:打造沉浸式视频体验