title: Nginx dynamic proxy_pass
body: <p>I'm trying to configure nginx to proxy when <code>$1</code> is the path to a unix socket and $2 the uri :</p>
  
  <ul>
  <li><code>/user/&lt;username&gt;</code> => <code>/tmp/&lt;username&gt;/socket.sock /</code></li>
  <li><code>/user/&lt;username&gt;/a</code> => <code>/tmp/&lt;username&gt;/socket.sock /a</code></li>
  <li><code>/user/&lt;username&gt;/a/b</code> => <code>/tmp/&lt;username&gt;/socket.sock /a/b</code></li>
  </ul>
  
  <p><code>location ~/user/(.+)/(.*)$ {
      proxy_pass http://unix:/tmp/$1/socket.sock:/$2<br>
  }</code></p>
  
  <p>Of course it doesn't work for the third example</p>