Apache and PHP separately

I use Apache and PHP separately in two YAML files. A network is established between the containers and they see each other:

# docker exec -it nginx-php-php-fpm-1 ping apache-httpd-1
PING apache-httpd-1 ( 56(84) bytes of data.
64 bytes from apache-httpd-1.My_Network ( icmp_seq=1 ttl=64 time=0.180 ms
64 bytes from apache-httpd-1.My_Network ( icmp_seq=2 ttl=64 time=0.096 ms
64 bytes from apache-httpd-1.My_Network ( icmp_seq=3 ttl=64 time=0.100 ms
--- apache-httpd-1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2032ms
rtt min/avg/max/mdev = 0.096/0.125/0.180/0.038 ms

What should I do to connect Apache to PHP?


Did you’ve searched on the Internet for a tutorial? There are a lot like Apache and PHP on Docker. Consolidated instructions for getting… | by Dan Pupius | Writing by Dan Pupius or Setup an Apache, PHP, and HTTPS development environment with Docker (I have not read them).

The idea is to deliver static files using Apache and redirect to the php container when the extension is .php. It’s neverthless how I do.

You need Apache, PHP and a httpd.conf file for this.

For sure, you can find tutorials.