-1

I have a matomo container running with php-fpm

# docker-compose.yml

version: "3"

services:
  app:
    container_name: matomo
    image: matomo:fpm-alpine
    restart: unless-stopped
    volumes:
      - matomo:/var/www/html
    environment:
      - MATOMO_DATABASE_HOST=host.docker.internal
      - PHP_MEMORY_LIMIT=2048M
    env_file:
      - ./db.env
    ports:
      - "9000:9000"

volumes:
  matomo:

I want my local apache server to connect to this container so I wrote this a vhost conf

<VirtualHost *:80>
    ServerAlias myserver.com

    ErrorLog ${APACHE_LOG_DIR}/myserver.com/error.log
    CustomLog ${APACHE_LOG_DIR}/myserver.com/access.log combined

    <FilesMatch \.php$>
        SetHandler "proxy:fcgi://localhost:9000"
    </FilesMatch>

</VirtualHost>

Then when I call myserver.com it returns the "It works!" page.

And if I specify index.php it returns a 404 error

$ curl http://myserver.com/index.php
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.4.38 (Debian) Server at myserver.com Port 80</address>
</body></html>

Apache log says

[Tue Mar 01 12:09:11.732291 2022] [php:error] [pid 22242] [client 127.0.0.1:42424] script '/var/www/html/index.php' not found or unable to stat

Martial
  • 1,446
  • 15
  • 27

1 Answers1

0

You need to confirm the matomo source code could be visible inside and outside container. In this case, your source code is stored in docker volume, so when the connection created, apache only get the index.php of your document root and cannot access your matomo source. That's why you get 404 not found.