C
C
cereberlum2021-01-28 19:33:16
Nginx
cereberlum, 2021-01-28 19:33:16

How to enable http2 on nginx?

The nginx configuration (block server), just after 80 to add http2 does not work. When experimenting with this file, isp can generally crash, which is very unpleasant.

server {
        server_name localhost;
 disable_symlinks if_not_owner;
    listen 80;
    listen [::]:80;
    include /etc/nginx/vhosts-includes/*.conf;
    location @fallback {
        error_log /dev/null crit;
        proxy_pass [http://127.0.0.1:8080](http://127.0.0.1%3A8080);
        proxy_redirect [http://127.0.0.1:8080](http://127.0.0.1%3A8080) /;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        access_log off ;
    }
nginx version: nginx/1.16.1 sites have ssl certificates (Let's Encrypt) and work correctly.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sanes, 2021-01-28
@Sanes

listen 443 http2;

K
ky0, 2021-01-28
@ky0

Maybe it's just that the corresponding module is not connected - that's why it doesn't work for you, unlike the rest of the Internet?

D
Dr. Bacon, 2021-01-28
@bacon

nginx version: nginx/1.16.1 sites have ssl certificates (Let's Encrypt) and work correctly.
in the above config there is nothing about ssl, which means that either you do not provide the entire config, or ssl is connected at a higher level (server_name localhost, as it were, hints at this), so you need to "activate http2" at this "upper level".
Shl for a bunch of common tags, kicking.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question