0

I try to run very basic php app using apache and docker compose and have a problem with apache settings. When I try to access any static file in subdirectory I get lack of permissions. PHP calls seem to work fine.

So:

  • when I try to request localhost/LICENSE.txt I get the license.
  • when I try to access localhost/test.php or localhost/app/test.php it works fine
  • when I try to access localhost/app/test.html I get Forbiddenin the browser andclient denied by server configuration: /var/www/localhost/htdocs/src/app/test.html` in error log

Of course files I try to request are in the right locations.

Here's apache version I am trying to run:

/var/www/localhost/htdocs # httpd -v
Server version: Apache/2.4.33 (Unix)
Server built:   Mar 27 2018 11:32:10

Here's my host config:

<VirtualHost *:80>
    ServerAdmin test@example.com
    DocumentRoot /var/www/localhost/htdocs/src
    ServerName schmidt.local

    <Directory "/var/www/localhost/htdocs/src">
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   AllowOverride FileInfo AuthConfig Limit
        #
        AllowOverride All
        #
        # Controls who can get stuff from this server.
        #
        Require all granted
        RewriteEngine On

    </Directory>
    <LocationMatch "^/(.*\.php(/.*)?)$">
        ProxyPass fcgi://php-fpm:7000/var/www/localhost/htdocs/src/$1
    </LocationMatch>

</VirtualHost>

So as you can see I already have request instead of allow as suggested here.

Tomasz Kapłoński
  • 1,320
  • 4
  • 24
  • 49
  • it's not enough for the files to be in the right location, or for apache to allow requests through, the account that apache runs under must also have permission to access the file on disk. Check the permissions to the file. – ADyson Jun 27 '18 at 08:53
  • So, a php file works and html doesn't? Is there an .htaccess file in this directory, forbidding the access? – user4035 Jun 27 '18 at 08:56

0 Answers0