Search code examples
nginxhttp2

How to enable h2c in Nginx?


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


Solution

  • 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.