
try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; nginx 没有 error log
php-fpm
listen = 127.0.0.1:9000 listen.backlog = -1 listen.allowed_clients = 127.0.0.1 docker run --name php -p 9000:9000 -v /xxx:/xxx -d php:v1 docker run --name nginx -p 8080:80 -v /xxx:/xxx --link php:php -d nginx:v1 1 eslizn 2019-08-12 20:08:33 +08:00 建议先看看 docker network 部分 |
2 xupefei 2019-08-12 20:14:11 +08:00 每个 container 的 127.0.0.1 是独立的。 你需要让两个容器运行在同一个 network 上,然后用 link 命令把 php 的 hostname 暴露给 nginx,然后让 php 监听 0.0.0.0:9000 并 expose 9000 ; nginx 连到 php:9000。 |
3 boks 2019-08-12 20:27:20 +08:00 执行:docker inspect php | grep "IPAddress" 得到的地址就是 nginx 配置的地址 |