docker icon indicating copy to clipboard operation
docker copied to clipboard

No matching DirectoryIndex / 403 Forbidden error

Open iquito opened this issue 6 years ago • 4 comments

When using phpmyadmin/phpmyadmin:latest or phpmyadmin/phpmyadmin:4.9 or phpmyadmin/phpmyadmin:4.8 accessing phpmyadmin via browser is not possible - this is the output from the container with latest:

phpmyadmin    | phpMyAdmin not found in /usr/src/app - copying now...
phpmyadmin    | Complete! phpMyAdmin has been successfully copied to /usr/src/app
phpmyadmin    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.3. Set the 'ServerName' directive globally to suppress this message
phpmyadmin    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.3. Set the 'ServerName' directive globally to suppress this message
phpmyadmin    | [Tue Jun 18 10:30:23.799723 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.19 configured -- resuming normal operations
phpmyadmin    | [Tue Jun 18 10:30:23.799923 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
phpmyadmin    | [Tue Jun 18 10:30:32.464147 2019] [autoindex:error] [pid 31] [client 172.20.0.1:46976] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
phpmyadmin    | 172.20.0.1 - - [18/Jun/2019:10:30:32 +0000] "GET / HTTP/1.1" 403 503 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"

And in the browser a 403 Forbidden error appears, so at least index.php seems to be missing in /var/www/html/ or maybe that directory is not correct.

If I use phpmyadmin/phpmyadmin:4.7 everything works fine, so a recent change seems to have caused this.

iquito avatar Jun 18 '19 10:06 iquito

I'm afraid I'm having trouble reproducing this. What is the exact command you're using to start the container, please?

I've just now successfully connected with

  • docker run --name pma49 -d -e PMA_HOST=192.168.56.2 -p 8091:80 phpmyadmin/phpmyadmin:4.9
  • docker run --name pmalatest -d -e PMA_HOST=192.168.56.2 -p 8090:80 phpmyadmin/phpmyadmin:latest

Accessing, of course, http://localhost:8090 and http://localhost:8091.

ibennetch avatar Jun 19 '19 01:06 ibennetch

I just checked my configuration again (from docker-compose), and the aspect which made it not work in 4.8 and 4.9 was me setting working_dir, which was just some leftover configuration from a previous container, which made the container copy the phpmyadmin files to that directory and not /var/www/html/ so Apache did not find any files at the expected location.

Not sure if this is the intentional behavior or not - it was certainly an unnecessary configuration on my part which led to the problem, but maybe setting a working directory should be ignored or used in the Apache config too, so everything is served from the defined working directory. This was my configuration for docker-compose which led to the problem:

version: "3.7"
services:
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        container_name: phpmyadmin
        tty: true
        working_dir: /usr/src/app
        ports:
            - "8080:80"
        networks:
            - app-network
        environment:
            PMA_HOST: 'db_schema'
            PMA_PORT: 3306
            PMA_USER: 'user'
            PMA_PASSWORD: 'password'

    db_schema:
        image: mysql/mysql-server:5.7
        container_name: db_schema
        environment:
            MYSQL_ROOT_PASSWORD: 'whatever'
            MYSQL_DATABASE: 'mytable'
            MYSQL_USER: 'user'
            MYSQL_PASSWORD: 'password'
        networks:
            - app-network

networks:
    app-network:
        driver: bridge

iquito avatar Jun 19 '19 08:06 iquito

@iquito so you solved the issue ?

williamdes avatar Sep 30 '19 18:09 williamdes

Yes, by not defining working_dir. If you define working_dir (to something other than the default), then it will not work, because phpmyadmin will be copied to that working_dir but Apache will not use it.

I did not close this issue because this seems unintended: either working_dir should be ignored, or Apache should also use working_dir.

iquito avatar Oct 01 '19 13:10 iquito