简体   繁体   English

Docker:Nginx + PHP-FPM和多个站点

[英]Docker: Nginx + PHP-FPM and multiple sites

I'm new in Docker, and I'm searching about to install multiple sites in differents containers. 我是Docker的新手,我正在寻找在不同的容器中安装多个站点。

I made 2 containers, 1 with Nginx and 1 with php-fpm, sharing a volumen with the PHP files. 我制作了2个容器,1个用Nginx,1个用php-fpm,用PHP文件共享一个卷。

My idea is create 1 Nginx container for each site, but I don't want to create 1 php-fpm container for each site. 我的想法是为每个站点创建1个Nginx容器,但我不想为每个站点创建1个php-fpm容器。

What is the best way to have multiple site with Docker ? 使用Docker建立多个站点的最佳方法是什么?

UPDATE UPDATE

I made my own Docker image, with Nginx and PHP-FPM, based on the official Nginx image. 我使用Nginx和PHP-FPM制作了自己的Docker镜像,基于官方的Nginx图像。 Both services in the same container. 两个服务都在同一个容器中。

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

A common practise today is having PHP-FPM and nginx in each container. 今天的常见做法是在每个容器中使用PHP-FPM和nginx。 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. 无论如何,大部分负载都将在PHP-FPM上,因此即使它不是100%单个应用程序容器,nginx开销也可以忽略不计。

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. 一旦你为每个应用程序(网站)的专用容器,你可以使用像这样添加另一个nginx的层将路由请求,并让您体验更加舒适。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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