NginxをHTTP/3対応させるパッチがCloudflareから提供されました (CloudflareのHTTP/3ライブラリ Quicheを利用しています。現状ではHTTP/3ドラフト23版の対応になります)
github.com
基本的に、書いてるとおりにやればビルドできるのですが、無事HTTP/3しゃべるところまで確認できました
ビルド
rustインストールしておく
$ curl https://sh.rustup.rs -sSf | sh $ source $HOME/.cargo/env
書いてあるとおり
$ curl -O https://nginx.org/download/nginx-1.16.1.tar.gz
$ tar xzvf nginx-1.16.1.tar.gz
$ git clone --recursive https://github.com/cloudflare/quiche
$ cd nginx-1.16.1
$ patch -p01 < ../quiche/extras/nginx/nginx-1.16.patch
$ ./configure \ # ./configureで実行した
--prefix=$PWD \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_v3_module \
--with-openssl=../quiche/deps/boringssl \
--with-quiche=../quiche nginx.conf の編集
nginx-1.16.1$ vim ./conf/nginx.conf #下記を追記
server {
listen 4433 quic;
server_name localhost;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_certificate /path/to/server.crt;
ssl_certificate_key /path/to/server.key;
location / {
root html;
index index.html index.htm;
}
} 起動
nginx-1.16.1$ sudo ./objs/nginx
接続してみる
quicheのサンプルクライアントで接続する (draft-23バージョンでネゴシエーションします)
quiche$ cargo build --examples quiche$ target/debug/examples/http3-client https://127.0.0.1:4433/index.html --no-verify |head -n3 <!DOCTYPE html> <html> <head>
ちゃんとHTTP/3でアクセスログにも着てる
nginx-1.16.1$ tail ./logs/access.log 127.0.0.1 - - [16/Oct/2019:18:21:43 +0900] "GET /index.html HTTP/3" 200 612 "-" "quiche" 127.0.0.1 - - [16/Oct/2019:18:21:45 +0900] "GET /index.html HTTP/3" 200 612 "-" "quiche" 127.0.0.1 - - [16/Oct/2019:18:22:19 +0900] "GET /index.html HTTP/3" 200 612 "-" "quiche"
パケットキャプチャもこの通り