gpt4 book ai didi

php - 官方镜像中禁止 Docker PHP

转载 作者:行者123 更新时间:2023-12-01 01:58:28 25 4
gpt4 key购买 nike

我正在测试官方镜像 docker PHP:

docker run -d -p 8000:80 --name test php:7-apache

然后,我测试 http://localhost:8000 ,我发现这个:
Forbidden

You don't have permission to access / on this server.

我究竟做错了什么?

最佳答案

此图像中不包含 hello world,/var/www/html/为空,因此没有内容可查看。您需要将自己的代码捆绑为 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/

关于php - 官方镜像中禁止 Docker PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38602716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com