phpearth / docker-php

🐳 Docker For PHP developers - Docker images with PHP, Nginx, OpenLiteSpeed, Apache, Lighttpd, and Alpine
https://docs.php.earth/docker
MIT License
261 stars 80 forks source link

using with apache #32

Open hcliff opened 5 years ago

hcliff commented 5 years ago

Hey, thanks for the project, super helpful.

I've been trying to deploy with apache, and I'm having some issues.

if my dockerfile reads identically to the getting started, everything works

FROM phpearth/php:7.2-nginx

but if I use the apache image instead

FROM phpearth/php:7.2-apache

I get stuck with "it works" at localhost instead of my files. Could you point me to some docs? thanks!

antwal commented 5 years ago

same problem

adaliszk commented 5 years ago

Have you guys put a different index.php file into the /var/www/html location?

petk commented 5 years ago

Have you guys put a different index.php file into the /var/www/html location?

No. It should be the default index.html file from Alpine and Apache.

To use Apache image, you need to mount volume with you app into it and adjust Apache settings (/etc/apache2/...).

Best probably to do so by building and extended image:

FROM phpearth/php:7.3-apache

RUN ...

COPY . /

docker run -it --rm -p 80:80 -v pwd:/var/www/app phpearth/php:7.3-apache

adaliszk commented 5 years ago

True, I would do the custom Dockerfile with custom configs with a serious project, but if you just want to check it out, you can just put your app into the default location.

With a more serious project I would even split the server and the FPM to run them as main processes instead of the runit.

petk commented 5 years ago

Example how to use Apache image: https://github.com/petk/bugs.php.net basically yes you need an orchestration tool here to properly link running containers together. This example here uses Docker Swarm for example. Otherwise you can also simply use docker-compose tool...