Nginx 和 PHP 镜像:
root@OpenWrt:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
php 7.2-fpm 2f2db309f0ae 2 weeks ago 365MB
nginx latest 274c632b9f13 2 weeks ago 125MB
容器代码
docker run --name myphp-fpm -v /opt/nginx/www:/www -d php:7.2-fpm
docker run --name php-nginx-kodbox -p 8880:7880 -d \
-v /opt/nginx/www:/usr/share/nginx/html:ro \
-v /opt/nginx/conf.d:/etc/nginx/conf.d:ro \
--link myphp-fpm:php \
nginx
容器在 linux 中运行
root@OpenWrt:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a7816b52f12 nginx "/docker-entrypoint.…" 52 minutes ago Up 11 minutes 80/tcp, 0.0.0.0:8880->7880/tcp php-nginx-kodbox
e42944b8defa php:7.2-fpm "docker-php-entrypoi…" About an hour ago Up 52 minutes 9000/tcp myphp-fpm
确保路径(/opt/nginx/www)下面有安装 php 解压文件
现在问题是访问 php 文件的时候出现 404,然后我加了个静态 html 文件进去后,是可以访问的。
请问我哪儿出错了?
纯新手学习,谢谢了~~~~~~~~~
1
wangjincp OP 我看了一下日志
20#20: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.0.1, server: localhost, request: \"GET / HTTP/1.1\", upstream: \"fastcgi://172.31.0.2:9000\", host: \"10.0.0.254:8880\"\n","stream":"stderr","time":"2020-06-24T12:00:01.888439939Z"} |