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

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
 

相关文章:

  • 【C/C++】线程安全初始化:std::call_once详解
  • VoltAgent 是一个开源 TypeScript 框架,用于构建和编排 AI 代理
  • 【题解-洛谷】B4278 [蓝桥杯青少年组国赛 2023] 简单算术题
  • Java 注解与反射(超详细!!!)
  • React从基础入门到高级实战:React 生态与工具 - React 国际化(i18n)
  • Mac系统下,利用wget批量下载ICESat-2测高内陆水位高数据ALT13
  • SpringBoot整合RocketMQ--实例
  • RTX腾讯通停服后,有哪些兼容Linux及移动端的升级途径?
  • SQL(Database Modifications)
  • 杏仁海棠花饼的学习日记第十四天CSS
  • Windows 11 全角半角切换方法
  • 《仿盒马》app开发技术分享-- 订单列表页(端云一体)
  • 日常--OBS+mediamtx实现本地RTMP推流环境搭建(详细图文)
  • Telegram平台分发其聊天机器人Grok
  • 【仿生系统】爱丽丝的“内在”或“灵魂”:概念与形式
  • 关于《DAHSF》即《火小兔智慧开发平台V2.0》的碎碎念
  • 微机系统-汇编语言入门
  • 计算机图形学:(六)渲染管线
  • 基于matlab遗传算法和模拟退火算法求解三维装箱优化问题
  • Virtuoso中对GDS文件进行工艺库转换的方法
  • 那个网站的是做vb题目的/微信软文范例100字
  • 免费做网站凡科/上海网站建设关键词排名
  • 上海加盟网网站建设/深圳互联网公司50强
  • 广东省建设厅官方网站多少钱/互联网营销的方法有哪些
  • 重生北京上大学开网吧做网站的小说/做网络推广工作怎么样
  • 有哪些免费做外贸的网站/友情链接教程