[英]Run Docker PHP-apache: Forbidden You don't have permission to access / on this server
I have a folder: my-php-app
and it contains a Dockerfile
and a src/
folder. 我有一个文件夹:
my-php-app
,它包含一个Dockerfile
和一个src/
文件夹。 The Dockerfile is very simple: Dockerfile非常简单:
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 我的
src/
包含一个index.php
index.php
包含
<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: 但是当我访问我的本地主机时:80我看到:
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.
我在这做错了什么。
您也可以将文件“chown -R”改为www-data而不是本地用户名!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.