如何在Docker容器上部署php-fpm和在localhost(Ubuntu)上部署apache/nginx

问题描述:

我们可以将apache和php部署在单独的docker容器中,然后进行链接.

We can deploy apache and php in separate docker containers and then link them.

但是有什么方法可以在本地安装apache(使用apt-get install apache2)和php-fpm并在docker容器中进行链接?

But is there any way to install apache locally (using apt-get install apache2) and php-fpm in docker container and then link them?

谢谢

您可以构建自己的映像,并在Dockerfile中可以 apt install ...

you can build your own image and in the Dockerfile you can apt install ...

,但是这里还有一个带有apache + php-fpm的官方映像: https://hub.docker.com/_/php

but there is also an official image with apache + php-fpm here: https://hub.docker.com/_/php

所以您不必.准备好了.

so you dont have to. its ready to go.

但是我相信它可以通过公开您的 php-fpm 端口并将您的Apache FastCgiExternalServer配置为该端口而不是unix套接字来起作用.

but i believe it could work by exposing your php-fpm port and configuring your apache FastCgiExternalServer to this port instead of a unix socket.