我试图在docker中使用nginx和php-fpm上的单独容器运行wordpress;我已经配置了nginx来访问php的php-fpm容器。我可以看到nginx将php文件转发到fpm容器但是会失败。我可以在容器上看到以下错误:
web_1 | 2018/06/07 06:12:57 [error] 7#7: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.18.0.1, server: wp.startech-rd.tk, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://172.18.0.3:9000", host: "127.0.0.1"
编辑:添加docker-compose.yml
version: '3'
services:
web:
depends_on:
- db
- php
image: nginx:latest
hostname: wp.startech-rd.tk
ports:
- "80:80"
restart: always
environment:
MYSQL_HOST: db:3306
volumes:
- ./nginx/wp.startech-rd.tk.conf:/etc/nginx/conf.d/default.conf
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./wp:/usr/share/nginx/html:rw
db:
image: percona:5.7
hostname: db.startech-rd.tk
restart: always
expose:
- 3306
environment:
MYSQL_ROOT_PASSWORD: test
MYSQL_DATABASE: wp
MYSQL_USER: wp_user
MYSQL_PASSWORD: wp_password
php:
image: busterm/php7.2-fpm
hostname: php.startech-rd.tk
restart: always
expose:
- 9000
任何想法如何解决这个问题?