NginxのHTTP/3対応版が公開されました。実際に動かしていきます。(なお、現在サポートしているのはHTTP/3 draft 27版です)
www.nginx.com
基本的には 「README」 の通りやるだけです。
HTTP/3の詳細についてはガッツリ解説を書いたので、ご参考にしていただければ
asnokaze.hatenablog.com
準備
(ちなみに環境は Ubuntu18.04 Bionicです)
パッケージのインストールと、依存するboringsslのビルドをしておきます
https://boringssl.googlesource.com/boringssl/+/HEAD/BUILDING.md
$ sudo apt install mercurial ninja-build $ git clone https://boringssl.googlesource.com/boringssl $ cd ./boring/ $ mkdir build $ cd build $ cmake -GNinja .. $ ninja $ ../
nginxのビルド
ビルドします
$ hg clone -b quic https://hg.nginx.org/nginx-quic
$ cd nginx-quic
$ ./auto/configure --with-debug --with-http_v3_module \
--with-cc-opt="-I../boringssl/include" \
--with-ld-opt="-L../boringssl/build/ssl \
-L../boringssl/build/crypto"
$ make
$ #sudo make install ##面倒くなければ install してしまっても良い
設定と起動
/usr/local/nginx/conf/nginx.conf にこんな感じで入れます
listenにhttp3とreuseportを指定します。また、HTTP3対応をクライアントに通知するために、Alt-Svcヘッダを送ります。
http {
server {
# for better compatibility it's recommended
# to use the same port for quic and https
listen 443 http3 reuseport;
listen 443 ssl;
ssl_certificate certs/example.com.crt;
ssl_certificate_key certs/example.com.key;
ssl_protocols TLSv1.3;
location / {
# required for browsers to direct them into quic port
add_header Alt-Svc 'h3-27=":443"; ma=60';
}
}
}
