Here’s the background:

Docker, a container alpine runs Apache (2.4.33, mpm_event mode),

The other container runs php-FPM (7.2.8), so Apache and php-FPM become interlinked remotely.


Many Settings refer to a large number of night data debugging, all reported errors:

AH01071: Got error ‘Primary script unknown\n’


After verifying the configuration one by one, the problem was discovered unexpectedly. First, configure the correct configuration:

1. httpd.conf 

* Remove php7 lines similar to AddType application/x-httpd-php, this is not used by php-fpm.

* A similar paragraph to the following is not needed in httpd.conf:

<FilesMatch \.php$> SetHandler “proxy:fcgi://php-fpm:9000” </FilesMatch>


2. The correct configuration only requires this line:

ProxyPassMatch ^/(.*\.php(/.*)?) $ fcgi://php-fpm:9000/v/php-fpm/www/$1

This line is in the <VirtualHost> of your vhost.conf.


Pay special attention!

1. My DocumentRoot and ProxyPassMatch paths do not match!

DocumentRoot /v/apache/ WWW If fcgi:// pushes the data to the php-fpm container, the php-fpm container needs to read the /v/apache/ WWW path. The foreground page says “File not find!”


Therefore, the core idea of the solution is to make the two containers have a common accessible file address. I don’t need to go into this, but mount it and so on.


2. Pay attention to phP-fpm listen

\php-fpm.d\www.conf

Listen = 172.0.3:9000

Here you cannot write 127.0.0.1, 2 containers in a virtual Intranet segment, you also write the Intranet address in the network segment.