title: NGINX virtual hosts with seperate lua_package_path variables
body: <p>I'm trying to serve two (Openresty) Lua web applications as virtual hosts from NGINX which both require their own unique <code>lua_package_path</code>, but have a hard time getting the configuration right.</p>
  
  <pre><code># Failing example.conf
  
  http {
    lua_package_path = "/path/to/app/?.lua;;"
  
    server{
      listen       80;
      server_name  example.org
    }
  }
  
  http {    
    lua_package_path = "/path/to/dev_app/?.lua;;"
  
    server{
      listen       80;
      server_name  dev.example.org
    }
  }
  </code></pre>
  
  <ol>
  <li><p>If you define the <code>http</code> twice (one for each host), you will receive this error: <code>[emerg] "http" directive is duplicate in example.conf</code></p></li>
  <li><p>If you define the <code>lua_package_path</code> inside the <code>server</code> block, you will receive this error: <code>[emerg] "lua_package_path" directive is not allowed here in example.conf</code></p></li>
  <li><p>If you define the <code>lua_package_path</code> twice in a <code>http</code> block (which does not make any sense anyway), you will receive this error: <code>[emerg] "lua_package_path" directive is duplicate in example.conf</code></p></li>
  </ol>
  
  <p>What is the best practise of serving multiple (Openresty) Lua applications with their own <code>lua_package_path</code>, being virtual hosts on the same IP and port?</p>