This is my docker-compose.yaml file
services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
volumes_from:
- app
app:
build:
dockerfile: ./php/Dockerfile
volumes:
- ./app:/app
And this is my nginx config file:
server {
listen 80;
server_name localhost;
root /app/public;
index index.php;
location ~ .php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
What I’m doing wrong?
I run ‘docker compose up’ but it is showing me this message:
nginx: [emerg] host not found in upstream “php” in /etc/nginx/conf.d/default.conf:8
New contributor
Aleks555 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.