Skip to content

[Question] Serving fpm-alpine image with nginx #253

Description

@lonix1

I am trying to get the fpm-alpine image to work with nginx.

docker-compose.yml

version: "3.7"networks:
mynet:
volumes:
mariadb_data:
phpmyadmin_data:
services:
mariadb:
image: mariadb:10.4.8-bionicenvironment:
MYSQL_DATABASE: mydbMYSQL_ROOT_PASSWORD: passwordMYSQL_USER: adminMYSQL_PASSWORD: passwordvolumes:
- mariadb_data:/var/lib/mysql/networks:
- mynetphpmyadmin:
image: phpmyadmin/phpmyadmin:fpm-alpinevolumes:
- phpmyadmin_data:/var/www/html/networks:
- mynetdepends_on:
- mariadbnginx:
image: nginx:1.17.4-alpinevolumes:
- ./default.conf:/etc/nginx/conf.d/default.conf:ro
- phpmyadmin_data:/var/www/html/:roports:
- "80:80"networks:
- mynetdepends_on:
- mariadb
- phpmyadmin

default.conf

resolver127.0.0.11 valid=15s;server{listen80;server_name www.example.com;root /var/www/html/;indexindex.php index.html index.htm;set$upstream phpmyadmin:9000;location~\/pma {fastcgi_pass$upstream;fastcgi_indexindex.php;fastcgi_split_path_info ^(.+\.php)(/.*)$;include fastcgi_params;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fastcgi_path_info;}}

Then: docker-compose up.

When I access http://www.example.com/pma I get

502 Bad Gateway

I also tried to get it working using a port instead of path, i.e. http://www.example.com:8080 instead of http://www.example.com/pma.

The docs show examples using traefik and haproxy, but not for nginx.

Can someone spot the error in my setup, or does someone have a working example to share?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions