cd openssl-1.1.1q/ ./config --prefix=/usr/openssl-1.1.1q shared # make make CPU=native USE_PCRE2=1 USE_PCRE2_JIT=1 USE_OPENSSL=1 SSL_LIB=/usr/local/openssl-1.1.1/lib SSL_INC=/usr/local/openssl-1.1.1/include USE_ZLIB=1
global log 127.0.0.1 local3 info chroot /var/lib/haproxy maxconn 512 user haproxy group haproxy daemon pidfile /var/run/haproxy.pid # do not keep old processes longer than that after a reload hard-stop-after 5m # The command-line-interface (CLI) used by the admin, by provisionning # tools, and to transfer sockets during reloads stats socket /var/run/haproxy-svc1.sock level admin mode 600 user haproxy expose-fd listeners stats timeout 1h # intermediate security forSSL, fromhttps://ssl-config.mozilla.org/ ssl-default-bind-ciphers TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 ssl-default-bind-options prefer-client-ciphers no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets
Enable HTTP/2 over HTTP (h2c)To enable HTTP/2 between clients and HAProxy without using TLS, use the proto parameter to announce support for it. This method does not allow you to support multiple versions of HTTP simultaneously. gRPC 使用HTTP2作为通信协议,可使用HTTP/2 或者 HTTP (h2c) ,可以使用此方法实现 haproxy proxy gRPC。
frontend ods bind *:9093 proto h2 default_backend ods_gw_servies
backend ods_gw_servies balance static-rr option tcp-check server server2 172.16.116.206:9093 check proto h2 server server3 172.16.116.95:9093 check proto h2
# 待补充 TODO One front that made impressive progress over the last few months is QUIC. While a few months ago we were counting the number of red boxes on the interop tests at https://interop.seemann.io/ to figure what to work on as a top priority, now we're rather counting the number of tests that report a full-green state, and haproxy is now on par with other servers in these tests. Thus the idea emerged, in order to continue to make progress on this front, to start to deploy QUIC on haproxy.org so that interoperability issues with browsers and real-world traffic can be spotted. A few attempts were made and already revealed issues so for now it's disabled again. Be prepared to possibly observe a few occasional hiccups when visiting the site (and if so, please do complain to us). The range of possible issues would likely be frozen transfers and truncated responses, but these should not happen. From a technical point, the way it's done is by having a separate haproxy process listening to QUIC on UDP port 1443, and forwarding HTTP requests to the existing process. The main process constantly checks the QUIC one, and when it's seen as operational, it appends an Alt-Svc header that indicates the client that an HTTP/3 implementation is available on port 1443, and that this announce is valid for a short time (we'll leave it to one minute only so that issues can resolve quickly, but for now it's only 10s so that quick tests cause no harm):
http-response add-header alt-svc 'h3=":1443"; ma=60'if { var(txn.host) -m end haproxy.org } { nbsrv(quic) gt 0 } As such, compatible browsers are free to try to connect there or not. Othertools (such as git clone) will not use it. For those impatient to test it, the QUIC process' status is reported at the bottom of the stats page here: http://stats.haproxy.org/. The "quic" socket in the frontend at the top reports the total traffic received from the QUIC process, so if you're seeing it increase while you reload the page it's likely that you're usingQUIC to read it. InFirefox I'm having this little plugin loaded: https://addons.mozilla.org/en-US/firefox/addon/http2-indicator/. It displays a small flash on the URL bar with different colors depending on the protocol used to load the page (H1/SPDY/H2/H3). When that works it's green (H3), otherwise it's blue (H2). For Chrome there is HTTP Indicator which does the same but displays an orange symbol when using H3. Chrome only accepts H3 on port 443 (which we enabled as well for it). Note that H2 and H3 are only served when the site is browsed in HTTPS at https://haproxy.org/. At this point I'd still say "do not reproduce these experiments at home". Amaury and Fred are still watching the process' traces very closely to spot bugs and stop it as soon as a problem is detected. But it's still too early for being operated by non-developers. The hope is that by 2.6 we'll reach the point where enthousiasts can deploy a few instances on not-too-sensitive sites with sufficient confidence and a little dose of monitoring.