nginx 'invalid number of arguments in "map" directive' : <p>I'm trying to reverse-proxy a websocket, which I've done with nginx before with no issue. Weirdly, I can't seem to re-create my prior success with something so simple. I've been over and over the config file but can't seem to find my error.</p>

<p>Here's my full <code>default.conf</code>:</p>

<pre><code>map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
  listen 80;

  location /api/ {
    proxy_pass ${API_LOCATION};
  }

  location / {
    proxy_pass ${UI_LOCATION};
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }
}
</code></pre>

<p>The error I'm getting:</p>

<pre><code>2016/10/10 23:30:24 [emerg] 8#8: invalid number of arguments in "map" directive in /etc/nginx/conf.d/default.conf:1
nginx: [emerg] invalid number of arguments in "map" directive in /etc/nginx/conf.d/default.conf:1
</code></pre>

<p>And the exact Dockerfile that I'm using, in case you want to replicate my setup (save <code>default.conf</code> as <code>conf.templates/default.conf</code> relative to the Dockerfile:</p>

<pre><code>FROM nginx
COPY conf /etc/nginx/conf.templates
CMD /bin/bash -c "envsubst &lt; /etc/nginx/conf.templates/default.conf &gt; /etc/nginx/conf.d/default.conf &amp;&amp; nginx -g 'daemon off;'"
</code></pre>
