nginx 1.25.1 发布

nginx 1.25.1 有一个很不错的特性,就是支持了http2 指令,以前这个指令主要是也listen 配置使用的(ssl+http2 场景)
独立指令之后就有了很方便的功能了,比如有些业务希望使用http0.9-1.1 协议,有些需要使用http2,当然目前也是支持了
http3的,可以做到分离,以前版本存在一个问题就是开启了之后协议就都是http2(当然浏览器是可以协商降级的)

参考使用配置

主要是测试

  • docker-compose 文件
 
version: "3"
services:
  app:
     image: nginx:1.25.1-alpine3.17-perl
     volumes:
       - ./nginx.conf:/etc/nginx/nginx.conf
       - ./ssl:/etc/nginx/ssl
     ports:
       - "80:80"
       - "443:443"
  • nignx 配置
user root;  
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  text/html;
    root /usr/share/nginx/html;
    gzip  on;
    resolver 114.114.114.114;
    server {
       listen 80;
       charset utf-8;
       server_name  demoapprong.com;
       default_type text/html;
       location / {
          index index.html index.htm;
       }
    }
    server {
        listen 443 ssl;
        server_name  clouddebug.tech;
        http2 on;
        ssl_certificate      /etc/nginx/ssl/clouddebug.tech.pem;
        ssl_certificate_key  /etc/nginx/ssl/clouddebug.tech.key;
        location / {
            index    index.html index.htm;
        }
    }
    server {
        listen 443 ssl;
        server_name  login.clouddebug.tech;
        http2 off;
        ssl_certificate      /etc/nginx/ssl/login.clouddebug.tech.pem;
        ssl_certificate_key  /etc/nginx/ssl/login.clouddebug.tech.key;
        location / {
            index    index.html index.htm;
        }
    }
}
  • 效果

 

说明

实际上官方commit 上也有说明,可以学习,参考以下信息

参考资料

https://nginx.org/en/CHANGES
https://hg.nginx.org/nginx/rev/08ef02ad5c54

posted on   荣锋亮  阅读(569)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 博客园 & 1Panel 联合终身会员上线
· 支付宝事故这事儿,凭什么又是程序员背锅?有没有可能是这样的...
· https证书一键自动续期,帮你解放90天限制
· 在 ASP.NET Core WebAPI如何实现版本控制?
· 告别虚拟机!WSL2安装配置教程!!!
历史上的今天:
2022-06-19 amass OWASP开源的深入的攻击面映射和资产发现工具
2021-06-19 spring boot cors 动态添加以及cookie 处理
2019-06-19 vigil rpm 包制作
2018-06-19 minio 集群搭建
2017-06-19 openresty 使用 log_by_lua 发送日志到 syslog-ng
2017-06-19 uuid 了解
2017-06-19 基于openresty 的几个开发框架

导航

< 2025年1月 >
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示