Open MrMage opened 4 years ago
We are using a setup where we use both the fpm
and the slim-apache
image. For the latter we disable the PHP7 module which is loaded by default and use an Apache proxy handler to integrate PHP-FPM
@mbrodala Thanks for sharing your setup! It is interesting to see how you disable the PHP7 to get a "pure" apache server :)
@MrMage, your assumption is right, the FPM image does not come with Apache installed.
Just for clarity: we don't simply use a basic/custom image for Apache to benefit from the same way configuration and permissions are handled.
I would like better if could have a single image for it like thecodingmachine/php:slim-apache
containing the latest version of php and apache.
Sorry to „revive“ this thread, but what is your approach to serving both static assets and the app when using PHP-FPM and Nginx/Apache in separate containers? Do you simply copy the entire „app“ directory (containing both code and assets) to both the „fpm“ and the „apache“ image?
Sorry to „revive“ this thread, but what is your approach to serving both static assets and the app when using PHP-FPM and Nginx/Apache in separate containers? Do you simply copy the entire „app“ directory (containing both code and assets) to both the „fpm“ and the „apache“ image?
Nginx need to have the static files, not the code. So I use it like this in a multi stage Dockerfile (simplified below):
FROM thecodingmachine/php:8.1-v4-slim-fpm as php
COPY project ./
...
RUN php bin/console cache:clear
RUN php bin/console assets:install
FROM nginx:1.21-alpine AS nginx
COPY --from=php /var/www/html/public public/
It appears that the FPM images use
php-fpm
as their entry point, indicating that they only launch the FPM service but do not support serving HTTP requests directly.Is that assumption correct, or does the image somehow launch Apache as well?
In the former case, do you have any recommendations on how to connect this with an Apache or Nginx instance that functions as an HTTP server? Ideally, that server should serve both the FPM service via HTTP as well as some additional static assets. I might be able to wire something up myself but was wondering whether you had already considered that use case — an FPM service by itself still needs an HTTP server, after all.
(I have searched for existing issues about this, but could not find any.)