简体   繁体   中英

Docker: Nginx + PHP-FPM and multiple sites

I'm new in Docker, and I'm searching about to install multiple sites in differents containers.

I made 2 containers, 1 with Nginx and 1 with php-fpm, sharing a volumen with the PHP files.

My idea is create 1 Nginx container for each site, but I don't want to create 1 php-fpm container for each site.

What is the best way to have multiple site with Docker ?

UPDATE

I made my own Docker image, with Nginx and PHP-FPM, based on the official Nginx image. Both services in the same container.

https://hub.docker.com/r/dignajar/nginx-php-fpm/

A common practise today is having PHP-FPM and nginx in each container. Most of the load will be on PHP-FPM anyway, so even though it's not a 100% single application container, nginx overhead can be considered negligible.

Once you have dedicated containers for each application (website), you can use something like this to add yet another nginx layer that will route requests and make your experience more comfortable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM