Forbidden in oficial image Docker PHP
I testing the oficial image docker PHP:
Then, I test http://localhost:8000, I find this:
Forbidden You don't have permission to access / on this server.
what am I doing wrong?
2 Solutions collect form web for “Forbidden in oficial image Docker PHP”
There’s no hello world included with this image,
/var/www/html/ is empty so there’s no content to view. You need to bundle your own code in as the page on this image instructs:
We recommend that you add a custom php.ini configuration. COPY it into
/usr/local/etc/php by adding one more line to the Dockerfile above and
running the same commands to build and run:
FROM php:7.0-apache COPY config/php.ini /usr/local/etc/php/ COPY src/ /var/www/html/
docker run -d -p 8000:80 --name test php:7-apache -v "$PWD":/var/www/html
Go to your project folder and run the above command or replace $PWD with your project directory. -v will sync your project to the docker container.
Or create a Docker file and use copy to run your project within the container.
Any one of the above will solve your problem.
The probable reason for the error is the fact that there is no project to render.