<p>I try to serve 2 web applications that should be powered by hhvm. It is easy to build up one docker image that includes nginx and the default.conf. But now where I will get <code>n</code> apps as microservices I want to test them and share the nginx container as I proceed with others like DB e.g.</p>

<p>So when nginx is externally accessed with hhvm do I have to provide hhvm on this image too? Or can I refer it to the debian where hhvm is already provided? Then, I could store the <code>nginx.conf</code> with something like this:</p>

<pre><code>upstream api.local.io {
   server 127.0.0.1:3000;
}

upstream booking.local.io {
   server 127.0.0.1:5000;
}
</code></pre>

<p>How can I set up a proper nginx container for this?</p>

<p>Yeah, you can create another nginx container with an <code>nginx.conf</code> that is configured similarly to this:</p>

<pre><code>upstream api {
   # Assuming this nginx container can access 127.0.0.1:5000
   server 127.0.0.1:3000;
   server server2.local.io:3000;
}

upstream booking {
   # Assuming this nginx container can access 127.0.0.1:5000
   server 127.0.0.1:5000;
   server server2.local.io:5000;
}

server {
    name api.local.io;
    location / {
        proxy_pass http://api;
    }
}

server {
    name booking.local.io;
    location / {
        proxy_pass http://booking;
    }
}
</code></pre>
