简体   繁体   中英

docker PHP-APACHE "You don't have permission to access / on this server”

I'm using the official docker images for apache and php : https://hub.docker.com/_/php/ (the 5.6-apache tag)

I'm launching the container like this :

docker run -d -p 80:80 --name apache-php56 -v "/home/myUser/www":/var/www/html php:5.6-apache

Of course, I have all my code in "/home/myUser/www"

When I am in a directory with an index, it seems like apache is displaying the page pretty well. However if I am in a directory without index, apache tells me that I don't have permission to access. I would like apache to show me the "classical" view when there is no index with the "Name Last modified Size Description" and I can navigate through until I find an index.

I'm pretty sure this is a simple config in the default apache2.conf that forbid me but I have no idea which.

Thanks by advance.

I had the same problem with my symfony project while using docker. The problem was that the .htaccess file was missing in the web folder. You can create one by your self or you can install symfony/apache-pack with composer if you use symfony. An example .htaccess can be found in the symfony documentation for web server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM