By Rob Lao
Hi,
I read following article about setup nginx virtual hosts. https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts
However, I require a bit further. If I have multiple docker containers with one website hosted in each, how to do that with nginx? Is there a tutorial about how to do this?
Thanks Rob L
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This question was answered by @ryanpq:
What I would recommend is to set up your individual containers with their services listening on different ports and then use proxy_pass to proxy connections to the correct service. Since you could not have a web service in two different docker containers both listening on port 80 (at least publicly) you can use nginx to translate server blocks to ports either on the public network or the internal one used by docker.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.