No live upstreams while connecting to upstream, but upsteam is OK
<p>I have a really weird issue with NGINX.</p>

<p>I have the following <code>upstream.conf</code> file, with the following upstream:</p>

<pre><code>upstream files_1 {
    least_conn;
    check interval=5000 rise=3 fall=3 timeout=120 type=ssl_hello;

    server mymachine:6006 ;
}
</code></pre>

<p>In locations.conf:</p>

<pre><code>location ~ "^/files(?&lt;command&gt;.+)/[0123]" {
        rewrite ^ $command break;
        proxy_pass https://files_1 ;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
</code></pre>

<p>In /etc/hosts:</p>

<pre><code>127.0.0.1               localhost               mymachine
</code></pre>

<p>When I do: <code>wget https://mynachine:6006/alive  --no-check-certificate</code>, I get <code>HTTP request sent, awaiting response... 200 OK</code>. I also verified that port 6006 is listening with netstat, and its OK.</p>

<p>But when I send to the NGINX file server a request, I get the following error:</p>

<blockquote>
  <p>no live upstreams while connecting to upstream, client: .., request: "POST /files/save/2 HTTP/1.1, upstream: "<a href="https://files_1/save" rel="noreferrer">https://files_1/save</a>"</p>
</blockquote>

<p>But the upstream is OK. What is the problem?</p>