title: Issues moving Nginx to use HTTPS, could not be resolved (3: Host not found)
body: <p>So i have following nginx configuration :</p>
  
  <pre><code>events {
    worker_connections 1024;
  }
  
  http {
  
    server {
      listen 80 default_server;
      charset utf-8;
      access_log off;
      try_files $uri $uri/ =404;
      #use google as dns
      resolver 8.8.8.8;
      server_name www.workaround.xyz workaround.xyz;
      return 301 https://$server_name$request_uri;
    }
  
    server {
          listen 443 ssl;
          charset utf-8;
          access_log off;
          try_files $uri $uri/ =404;
          #use google as dns
          resolver 8.8.8.8;
          server_name www.workaround.xyz workaround.xyz;
  
          ssl_certificate /etc/letsencrypt/live/workaround.xyz-0001/fullchain.pem;
          ssl_certificate_key /etc/letsencrypt/live/workaround.xyz-0001/privkey.pem;
  
          location / {
              proxy_pass $scheme://workaround:8085/;
          }
  
          location ^~ {
              proxy_pass              $scheme://workaround:8085/$request_uri;
              proxy_redirect  off;
              proxy_set_header        X-Real-IP $remote_addr;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        Host $http_host;
              expires 30d;
           }
      }
  
  
  }
  </code></pre>
  
  <p>This is my attempt to move stuff to use HTTPS, and also to support www. prefix for domain. In this attempt i get :</p>
  
  <blockquote>
    <p>2019/07/03 20:55:38 [error] 6#6: *3 workaround could not be resolved
    (3: Host not found), client: XXXXX_SOME IP_XXXX, server:
    www.workaround.xyz, request: "GET / HTTP/1.1", host:
    "www.workaround.xyz"</p>
  </blockquote>
  
  <p><strong>Tried multiple differnt ways bud every time some variant of could not be resolved pops up , anyone has idea what i do wrong and what could i improve / fix to get it working properly with https?</strong></p>
  
  <p>Working HTTP version was this :</p>
  
  <pre><code>events {
    worker_connections 1024;
  }
  
  http {
  
    server {
          listen 80;
          charset utf-8;
          access_log off;
          try_files $uri $uri/ =404;
  
          location / {
              proxy_pass http://workaround:8085/;
          }
  
          location ^~ {
              proxy_pass              $scheme://workaround:8085/$request_uri;
              proxy_redirect  off;
              proxy_set_header        X-Real-IP $remote_addr;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        Host $http_host;
              expires 30d;
           }
      }
  
  
  }
  </code></pre>