title: How to include location blocks in nginx?
body: <p>I'm using <code>nginx</code> as a reverse proxy for 2 web apps.</p>
  <p>Those 2 web apps (UI) are sharing location proxies, as the backend services are shared.</p>
  <p>How can I combine location blocks and include them in the servers?</p>
  <p><strong>host.conf</strong></p>
  <pre><code>server {
    server_name app1.com
    listen 8080;
    ...
  
    include /opt/bitnami/nginx/conf/vhosts/proxy.conf;
  }
  
  server {
    server_name app2.com;
    listen 8080;
    ...
  
    include /opt/bitnami/nginx/conf/vhosts/proxy.conf;
  }
  </code></pre>
  <p><strong>proxy.conf</strong></p>
  <pre><code>location /api/videos {
    proxy_pass ...
  }
  ...
  </code></pre>
  <p>But I am getting the following error:</p>
  <pre><code>&quot;location&quot; directive is not allowed here in /opt/bitnami/nginx/conf/vhosts/proxy.conf:2
  </code></pre>