2

I am working in a LAMP stack using Docker and Docker-Compose and I am stuck since I am not able to execute PHP files meaning anytime I try http://localhost/index.php I end with the following 403 message:

Forbidden
You don't have permission to access /index.php on this server.

Currently I have two services running in different containers, see docker-compose.yml below:

version: '2'
services:
  php-fpm:
    container_name: "php-fpm"
    build: ../docker-php-fpm
    volumes:
      - ~/dev:/data/www
  httpd:
    container_name: "httpd"
    build: ../docker-httpd
    ports:
      - 8080:80
    volumes_from:
      - php-fpm
    links:
      - php-fpm

As you may notice PHP-FPM is running in one container, Apache (httpd) is running in a different one. Both containers and services on them are up and running.

I have a VirtualHost file on the httpd container with the following content:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /data/www
    DirectoryIndex index.php

    <Directory /data/www>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

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

    ErrorLog /dev/stderr
    CustomLog /dev/stdout combined
</VirtualHost>

At this point I am not sure if the problem is in the Virtual Host setup or the problem is that httpd container can't redirect .php files to php-fpm:9000.

In either way, can I get some help? If you want to take a closer look here is the httpd repository and here is the php-fpm repository.

ReynierPM
  • 700
  • 5
  • 14
  • 28

0 Answers0