嘟嘟社区

大佬们 lnmp中如何开启http/3


听闻http/3性能优异,lnmp一键包好像说是已经支持http/3了,
那么如何在lnmp中使用http/3
啊,投毒还没投够嘛?
站点的server块内加入以下内容开启quic
  1. server {
  2.     …
  3.         listen 443 ssl;
  4.         listen [::]:443 ssl;
  5.         listen 443 quic reuseport;
  6.         listen [::]:443 quic reuseport;
  7.         http2 on;
  8.         add_header Alt-Svc ‘h3=":443"; ma=86400’;
  9.         quic_retry on;
  10.         ssl_early_data on;
  11.     …
  12. }

复制代码

小白鸡 发表于 2024-10-11 10:27
啊,投毒还没投够嘛?

啥投毒啊   

first 检查
  1. root@hetzner-fsn1-002:~# nginx -V
  2. nginx version: nginx/1.26.2
  3. built by gcc 13.2.0 (Ubuntu 13.2.0-23ubuntu4)
  4. built with OpenSSL 1.1.1w  11 Sep 2023
  5. TLS SNI support enabled
  6. configure arguments: –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_v2_module –with-http_v3_module –with-http_gzip_static_module –with-http_sub_module –with-stream –with-stream_ssl_module –with-stream_ssl_preread_module –with-http_realip_module –with-openssl=/root/lnmp/src/openssl-1.1.1w –with-openssl-opt=enable-weak-ssl-ciphers –add-module=/root/lnmp/src/ngx-fancyindex-0.5.2

复制代码

然后 conf 设置

  1. server
  2.     {
  3.        #listen 443 ssl http2;
  4.        #listen [::]:443 ssl http2;
  5.         listen 443 ssl;
  6.         listen 443 quic reuseport;
  7.         listen [::]:443 ssl;
  8.         listen [::]:443 quic reuseport;
  9.         server_name yoursite.dev ;
  10.         index index.html index.htm index.php default.html default.htm default.php;
  11.         root  /home/wwwroot/yoursite.dev;

复制代码