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