如何配置两个docker(1-apache+mod_fcgi 2-php-fpm+phpmyadmin)
Posted
技术标签:
【中文标题】如何配置两个docker(1-apache+mod_fcgi 2-php-fpm+phpmyadmin)【英文标题】:How configure two dockers (1-apache+mod_fcgi 2-php-fpm+phpmyadmin) 【发布时间】:2021-08-10 07:33:19 【问题描述】:我尝试使用这组 docker,但无济于事。
在网上,我只找到了 docker 的用例:nginx + phpmyadmin (php-fpm)
如果有人可以帮助我进行此配置,我该如何配置 2 个 docker
-
阿帕奇
php-fpm + phpMyAdmin
我尝试将这些设置用于 apache 的 vhost.conf
PHP_FPM_CONTAINER=myDockerPhpMyAdmin:9000
<FilesMatch \.php$>
SetHandler proxy:fcgi://$PHP_FPM_CONTAINER
</FilesMatch>
和
PHP_FPM_CONTAINER=myDockerPhpMyAdmin:9000
<IfModule mod_fcgid.c>
Options +ExecCGI
FcgidConnectTimeout 20
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
ProxyPassMatch ^/$PHP_FPM_CONTEXT/(.*\.php(/.*)?)$ fcgi://$PHP_FPM_CONTAINER/\$1"
</IfModule>
【问题讨论】:
【参考方案1】:和我在这里的https://github.com/phpmyadmin/docker/issues/350类似
我在使用 phpmyadmin docker image 时遇到的主要问题是:
似乎配置错误,默认只提供 *.php 文件 它以 text/html 形式提供所有内容我的解决方案是:
对于虚拟主机
<VirtualHost 192.168.1.2:80>
ServerName phpmyadmin.local.lan
ProxyPreserveHost on
RewriteEngine on
RewriteRule ^/$ /index.php [P,QSA,L]
ProxyPass / "fcgi://127.0.0.1:9000/var/www/html/"
ProxyPassReverse / "fcgi://127.0.0.1:9000/var/www/html/"
<LocationMatch "^/.*\.css">
Header set Content-type "text/css"
</LocationMatch>
<LocationMatch "^/.*\.js">
Header set Content-type "text/javascript"
</LocationMatch>
</VirtualHost>
对于 docker compose:
version: "3.8"
services:
mariadb:
image: 'mariadb:10.5.13'
restart: always
hostname: 'mariadb'
environment:
mysql_ROOT_PASSWORD: 1234
volumes:
- './volumes/mariadb/varlibmysql:/var/lib/mysql'
ports:
- 3306:3306
phpmyadmin:
image: 'phpmyadmin:5.1.1-fpm-alpine'
restart: always
hostname: 'phpmyadmin'
ports:
- 127.0.0.1:9000:9000
volumes:
- './volumes/phpmyadmin/disablesecurity.conf:/usr/local/etc/php-fpm.d/disablesecurity.conf'
environment:
HIDE_PHP_VERSION: "true"
PMA_ARBITRARY: 1
PMA_ABSOLUTE_URI: https://phpmyadmin.local.lan/
depends_on:
- "mariadb"
./volumes/phpmyadmin/disablesecurity.conf 在哪里
[www]
security.limit_extensions =
【讨论】:
以上是关于如何配置两个docker(1-apache+mod_fcgi 2-php-fpm+phpmyadmin)的主要内容,如果未能解决你的问题,请参考以下文章