title: Unable to use http2 on nginx docker container
body: <p>I want to use http2 by nginx image, but i tried very long the protocol are still using http/1.1</p>
  
  <p>Dockerfile for nginx:</p>
  
  <pre><code>FROM nginx
  COPY ./docker/nginx/etc/nginx/nginx.conf /etc/nginx/nginx.conf
  COPY ./docker/nginx/etc/nginx/conf.d/default.conf.https /etc/nginx/conf.d/default.conf
  </code></pre>
  
  <p>/etc/nginx/nginx.conf is</p>
  
  <pre><code>user  nginx;
  worker_processes  auto;
  
  error_log  /var/log/nginx/error.log warn;
  pid        /var/run/nginx.pid;
  
  
  events {
      # run ulimit -n to check
      worker_connections  1024;
  }
  
  
  http {
      include       /etc/nginx/mime.types;
      default_type  application/octet-stream;
  
      log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
  
      access_log  /var/log/nginx/access.log  main;
  
      # Buffer size for post submission
      client_body_buffer_size 10k;
      client_max_body_size 8m;
  
      # Buffer size for header
      client_header_buffer_size 1k;
  
      sendfile        on;
      #tcp_nopush     on;
  
      keepalive_timeout  65;
  
      #gzip  on;
  
      include /etc/nginx/conf.d/*.conf;
  }
  </code></pre>
  
  <p>/etc/nginx/conf.d/default.conf is:</p>
  
  <pre><code> # Expires map
  map $sent_http_content_type $expires {
      default                    off;
      text/html                  epoch;
      text/css                   max;
      application/javascript     max;
      ~image/                    max;
  }
  
  server {
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      server_name 0.0.0.0;
      ssl_certificate /etc/nginx/certs/server.crt;
      ssl_certificate_key /etc/nginx/certs/server.key;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers   on;
      ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  
      expires $expires;
  
      location = /favicon.ico {
        log_not_found off;
      }
  
      location /static/ {
          alias /static_files/;
      }
  
      location / {
          access_log /var/log/nginx/wsgi.access.log;
          error_log /var/log/nginx/wsgi.error_log warn;
          proxy_pass http://app_wsgi:8000;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  
      location /ws/ {
          try_files $uri @proxy_to_ws;
      }
  
      location @proxy_to_ws {
          access_log /var/log/nginx/asgi.access.log;
          error_log /var/log/nginx/asgi.error_log warn;
          proxy_pass http://app_asgi:8001;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
      }
  }
  
  server {
      listen 80 default_server;
      listen [::]:80 default_server;
      server_name _;
      return 301 https://$host$request_uri;
  }
  
  </code></pre>
  
  <p>Docker-compose file for nginx part:</p>
  
  <pre><code>nginx:
      restart: always
      build:
        context: .
        dockerfile: docker/nginx/Dockerfile.https
      ports:
        - 80:80
        - 443:443
      volumes:
        - ./app/static:/static_files
        - ./ssl/certs:/etc/nginx/certs
      depends_on:
        - app_wsgi
        - app_asgi
  </code></pre>
  
  <p>go inside nginx container and run nginx -V command:</p>
  
  <pre><code>root@0a15f404bf1d:/# nginx -V
  nginx version: nginx/1.17.9
  built by gcc 8.3.0 (Debian 8.3.0-6) 
  built with OpenSSL 1.1.1d  10 Sep 2019
  TLS SNI support enabled
  configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.17.9/debian/debuild-base/nginx-1.17.9=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
  </code></pre>
  
  <p>is there anything wrong of my settings?</p>
  
  <p>i checked in chrome dev tool and saw all the request are still send through http/1.1 protocol</p>
  
  <p>my architecture is </p>
  
  <pre><code>Nginx &lt;-&gt; gunicorn &lt;-&gt; Django application
  </code></pre>