Skip to content

Instantly share code, notes, and snippets.

@weaming
Created October 23, 2019 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaming/e1ca9bc8203ed5f4e2f107813b68efbe to your computer and use it in GitHub Desktop.
Save weaming/e1ca9bc8203ed5f4e2f107813b68efbe to your computer and use it in GitHub Desktop.
#!/bin/bash
# Author : weaming
# Mail : garden.yuen@gmail.com
# Created : 2019-10-23 14:18:48
# https://blog.cloudflare.com/experiment-with-http-3-using-nginx-and-quiche/
# https://github.com/cloudflare/quiche/tree/master/extras/nginx#list-of-configuration-directives
# https://tools.ietf.org/html/rfc7838#section-3
# https://blog.cloudflare.com/http3-the-past-present-and-future/
# '/Applications/Google Chrome Canary.app' --enable-quic --quic-version=h3-23
# https://www.nginx.com/resources/wiki/start/topics/tutorials/installoptions/
# Test HTTP3 https://http3check.net/
# https://github.com/cuber/ngx_http_google_filter_module
# https://www.nginx.com/blog/thread-pools-boost-performance-9x/
# nginx -V
# nginx version: nginx/1.12.1 (Ubuntu)
# built with OpenSSL 1.0.2g 1 Mar 2016
# TLS SNI support enabled
# configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-K5HqCe/nginx-1.12.1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module
mkdir http3; cd http3;
curl -O https://nginx.org/download/nginx-1.16.1.tar.gz
tar xvzf nginx-1.16.1.tar.gz
git clone --recursive https://github.com/cloudflare/quiche
# google proxy
pcre_name='pcre-8.43'
wget https://ftp.pcre.org/pub/pcre/$pcre_name.tar.gz && tar -zxf $pcre_name.tar.gz
zlib_name='zlib-1.2.11'
wget http://zlib.net/$zlib_name.tar.gz && tar -zxf $zlib_name.tar.gz
git clone https://github.com/cuber/ngx_http_google_filter_module 2>/dev/null
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module 2>/dev/null
# more_set_headers
git clone https://github.com/openresty/headers-more-nginx-module.git 2>/dev/null
cd nginx-1.16.1 || exit
patch -p01 < ../quiche/extras/nginx/nginx-1.16.patch
./configure \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_v3_module \
--with-openssl=../quiche/deps/boringssl \
--with-quiche=../quiche \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--user=nginx \
--group=nginx \
--with-cc-opt="-D FD_SETSIZE=2048" \
--with-stream \
--with-stream_ssl_module \
--with-http_realip_module \
--with-http_sub_module \
--with-http_addition_module \
--with-threads \
--with-file-aio \
--with-http_stub_status_module \
--with-pcre=../$pcre_name \
--with-zlib=../$zlib_name \
--add-module=../ngx_http_google_filter_module \
--add-module=../ngx_http_substitutions_filter_module \
--add-module=../headers-more-nginx-module
make
make install
# nginx version: nginx/1.16.1
# built by gcc 7.2.0 (Ubuntu 7.2.0-8ubuntu3.2)
# built with OpenSSL 1.1.0 (compatible; BoringSSL) (running with BoringSSL)
# TLS SNI support enabled
# configure arguments: --with-http_ssl_module --with-http_v2_module --with-http_v3_module --with-openssl=../quiche/deps/boringssl --with-quiche=../quiche --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --user=nginx --group=nginx --with-cc-opt='-D FD_SETSIZE=2048' --with-stream --with-stream_ssl_module --with-http_realip_module --with-http_sub_module --with-http_addition_module --with-threads --with-file-aio --with-http_stub_status_module --with-pcre=../pcre-8.43 --with-zlib=../zlib-1.2.11 --add-module=../ngx_http_google_filter_module --add-module=../ngx_http_substitutions_filter_module --add-module=../headers-more-nginx-module
@weaming
Copy link
Author

weaming commented Oct 23, 2019

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment