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

http传输协议的加密

创建目录存放签证

[root@server100 ~]# mkdir /etc/nginx/certs
[root@server100 ~]# openssl req -newkey rsa:2048 -nodes -sha256 -keyout /etc/nginx/certs/timinglee.org.key -x509 -days 365 -out /etc/nginx/certs/timinglee.org.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]:CN
State or Province Name (full name) []:Shanxi
Locality Name (eg, city) [Default City]:Xi'an
Organization Name (eg, company) [Default Company Ltd]:timinglee
Organizational Unit Name (eg, section) []:webserver
Common Name (eg, your name or your server's hostname) []:www.timinglee.org
Email Address []:admin@timinlee.org

进行查看

[root@server100 ~]# ls /etc/nginx/certs/
timinglee.org.crt  timinglee.org.key
[root@server100 ~]# vim /etc/nginx/conf.d/vhosts.conf
server {listen 443 ssl;server_name login.timinglee.org;ssl_certificate "/etc/nginx/certs/timinglee.org.crt";ssl_certificate_key "/etc/nginx/certs/timinglee.org.key";root /usr/share/nginx/virtual/login;index index.html;
}
[root@server100 ~]# mkdir -p /usr/share/nginx/virtual/login
[root@server100 ~]# echo login.timinglee.org > /usr/share/nginx/virtual/login/index.html
[root@server100 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@server100 ~]# systemctl restart nginx.service

最后在windows里面测试,效果明显

首先在windows里面也要做解析

C:\Windows\System32\drivers\etc这个目录下的hosts里面,添加172.25.254.100 login.timinglee.org

然后在浏览器里面进行访问

选择高级,继续查看

强制走加密

[root@server100 ~]# vim /etc/nginx/conf.d/vhosts.conf
在443上面添加
server {
        listen 80;
        server_name login.timinglee.org;
        rewrite ^/(.*)$   https://login.timinglee.org/$1 permanent;
}

同样也需要做本地解析
[root@server100 ~]# curl -I login.timinglee.org/hehe
HTTP/1.1 301 Moved Permanently
Server: nginx/1.20.1
Date: Thu, 29 May 2025 09:31:06 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
Location: https://login.timinglee.org/hehe
 

http://www.xdnf.cn/news/9740.html

相关文章:

  • 黑马点评项目02——商户查询缓存(缓存穿透、缓存雪崩、缓存击穿)以及细节
  • 有关于常量的一节知识
  • JAVA学习 DAY1 初识JAVA
  • 生成式引擎的认知霸权:为什么传统内容失效?
  • 【AI非常道】二零二五年三月,AI非常道
  • 黑马程序员C++核心编程笔记--1 程序的内存模型
  • AniGS - 基于单张图像的动态高斯化身重建
  • 62、【OS】【Nuttx】编码规范解读(十)
  • 电缆中性点概念
  • webstrorm 提示(This file does not belong to the project)此文件不属于该项目
  • 深度学习-模型训练的相关概念
  • 【spring】spring中的retry重试机制; resilience4j熔断限流教程;springboot整合retry+resilience4j教程
  • java中自定义注解
  • WildDoc:拍照场景下的文档理解——数据真香
  • ETL怎么实现多流自定义合并?
  • 信奥之计算原理与排列组合
  • 人工智能在智慧物流中的创新应用与未来趋势
  • mybatis plus的源码无法在idea里 “download source“
  • 勾股数的性质和应用
  • JS逆向 【QQ音乐】sign签名| data参数加密 | AES-GCM加密 | webpack实战 (上)
  • Dify案例实战之智能体应用构建(一)
  • wewin打印机 vue版本 直接用
  • ABF膜介绍
  • 免杀二 内存函数与加密
  • QTest应用迷城
  • 鸿蒙完整项目-仿盒马App(一)首页静态页面
  • 极坐标下 微小扇环 面积微元
  • 数据库如何优化,尤其是历史温度数据计算品均值,实现小时,天,月的查询计算
  • Android和iOS DNS设置方式
  • C++链式调用与Builder模式