docker-php icon indicating copy to clipboard operation
docker-php copied to clipboard

using with apache

Open hcliff opened this issue 6 years ago • 5 comments

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!

hcliff avatar Apr 17 '19 12:04 hcliff

same problem

antwal avatar Apr 23 '19 16:04 antwal

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

adaliszk avatar May 01 '19 01:05 adaliszk

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

petk avatar May 01 '19 11:05 petk

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.

adaliszk avatar May 02 '19 06:05 adaliszk

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...

petk avatar May 04 '19 19:05 petk