Docker compose of mutiple sub-website Docker compose of mutiple sub-website nginx nginx

Docker compose of mutiple sub-website


You don't need to run nginx and php-fpm in different containers. (if your projects share same php version)

You run fpm as a service and in the same container run nginx in daemon-mode-off.

Then you go to nginx config and setup multiple subdomains.

Then setup data-volumes / shared folders according to your subdomain setup.

So you have single nginx/fpm instance which serves multple projects, and some other database/service containers


I agree with strangeqargo, you need only one container on which you can mount 2 volumes..

If the 2 projects use the same PHP and MariaDB version, just configure them correctly to use different databases but on the same container


Generally, I agree with both strangeqargo and intuix.

However, if you should require isolation between the sites, it would be best to setup separate php-fpm pools and separate users for each site, by have separate definitions in /etc/php5/fpm/pool.d/ with different unix sockets.

Each site definition in nginx should use the corresponding socket of the php-fpm pool.

This gives quite a good explanation on how to do that:https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04