Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable h2c in Nginx?

Tags:

nginx

http2

Is there a way to enable h2c aka HTTP2 cleartext in Nginx 1.9.5 onward?

I've tried using h2 over TLs in https://chronic101.xyz and it works, however I would like to implement h2c on port 80 as well.

Thanks,

chrone

like image 748
chrone Avatar asked Dec 05 '15 16:12

chrone


1 Answers

It should be as simple as adding http2 in the end of your listen directive.

Example:

server {
    listen 80 http2;

However, keep in mind that most browsers do not support unencrypted HTTP/2, and so will still serve content as HTTP/1.1.

like image 89
Gabriel Hautclocq Avatar answered Oct 17 '22 12:10

Gabriel Hautclocq