I have a folder: my-php-app
and it contains a Dockerfile
and a src/
folder. The Dockerfile is very simple:
FROM php:5.6-apache
COPY config/php.ini /usr/local/etc/php/
COPY src/ /var/www/html/
My src/
contains an index.php
The index.php
contains
<html>
<body>
<?php echo '<p>Hello World!</p>'; ?>
</body>
</html>
I did the following:
docker build -t my-php-app .
The new image was generated successfully. Now I want to start a container from that image:
docker run -d -p 80:80 my-php-app
But when I'm visiting my localhost:80 I see:
Forbidden
You don't have permission to access / on this server.
So my question is: How do I have to start my container properly? What am I doing wrong here.
You are not sharing your php.ini file, so I tried using the default production one provided by the PHP project and using that config file, I was able to run your project fine.
I suspect your issue lies there.
您也可以将文件“chown -R”改为www-data而不是本地用户名!
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.