nginx 1.25.1의 change log 살펴보니

Changes with nginx 1.25.1                                        13 Jun 2023
    *) Feature: the "http2" directive, which enables HTTP/2 on a per-server
       basis; the "http2" parameter of the "listen" directive is now
       deprecated.
    *) Change: HTTP/2 server push support has been removed.
    *) Change: the deprecated "ssl" directive is not supported anymore.
    *) Bugfix: in HTTP/3 when using OpenSSL.

http2 에 대해서 설정하는 방법이 달라졌고, per-server 단위 설정이 가능하다고 한다.


확인해보자.

기존의 설정인

server {
  listen 443 ssl http2;
  ssl_certificate server.crt;  
  ssl_certificate_key server.key;  
}

에서

server {  
    listen 443 ssl;  
    http2 on;  
    ssl_certificate server.crt;  
    ssl_certificate_key server.key;  
}

으로 변경 됐다.

nginx 1.24.0

server {
  server_name http2test.mingky.me;
  listen 80;
  listen 443 ssl http2;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {
    return 200;
  }
}
server {
  server_name http2test2.mingky.me;
  listen 80;
  listen 443 ssl;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {   
    return 200;
  }
}

curl 확인

curl https://http2test.mingky.me -I
HTTP/2 200 
server: nginx/1.24.0
date: Wed, 28 Feb 2024 08:33:39 GMT
content-type: application/octet-stream
content-length: 0

curl https://http2test2.mingky.me -I
HTTP/2 200 
server: nginx/1.24.0
date: Wed, 28 Feb 2024 08:33:42 GMT
content-type: application/octet-stream
content-length: 0

설정을 하지 않아도 http2로 연결되는 것을 확인 할 수 있다.

nginx 1.25.4

server {
  server_name http2test.mingky.me;
  listen 80;
  listen 443 ssl;
  http2 on;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {
    return 200;
  }
}
server {
  server_name http2test2.mingky.me;
  listen 80;
  listen 443 ssl;
  ssl_certificate server.crt;
  ssl_certificate_key server.key;
  location / {
    return 200;
  }
}

curl 확인

curl https://http2test.mingky.me -I 
HTTP/2 200 
server: nginx/1.25.4
date: Wed, 28 Feb 2024 08:42:03 GMT
content-type: application/octet-stream
content-length: 0

curl https://http2test2.mingky.me -I
HTTP/1.1 200 OK
Server: nginx/1.25.4
Date: Wed, 28 Feb 2024 08:42:05 GMT
Content-Type: application/octet-stream
Content-Length: 0
Connection: keep-alive
반응형

'메모 메모' 카테고리의 다른 글

돈을 내는 서비스는  (1) 2024.03.20
nginx SSL 인증서를 plain text로 넣는 방법  (0) 2024.03.08
보드게임 카페의 불편함 점.  (0) 2024.03.03
VSCode sudo로 debugging 하기  (0) 2024.02.29
nginx cache header struct  (0) 2024.02.29

+ Recent posts