matomo-org / docker

Official Docker project for Matomo Analytics
https://matomo.org
Other
833 stars 346 forks source link

nginx: [emerg] host not found in upstream "app:9000" in /etc/nginx/conf.d/default.conf:2 #176

Open PavanYadala opened 4 years ago

PavanYadala commented 4 years ago

On running the docker-compose on AWS ECS, the system is throwing below error. Please let me know how to fix it?

nginx: [emerg] host not found in upstream "app:9000" in /etc/nginx/conf.d/default.conf:2

renepardon commented 4 years ago

I've setup a fresh instance as well with the example docker-compose.yml file (slightly modificated for my use cases ;) ) The problem is, that you need to tell the nginx container to depend on the app container:

web:
  image: nginx:alpine
  depends_on:
    - app
  volumes:
  - ./matomo.conf:/etc/nginx/conf.d/default.conf:ro

@PavanYadala hope this helps you getting started :)

GopiPacha1996 commented 4 years ago

I have same issue i tried above setup but getting same issue

mhellmeier commented 3 years ago

There are several reasons for this error. One solution is already mentioned by @renepardon. If you add the depends_on flag and still got the error, check if you renamed your matomo app service. If it looks like this:

services:
  my-matomo-db:
    image: mariadb

  # [...]

  my-matomo-app:
    image: matomo:fpm-alpine

  # [...]

  my-matomo-web:
    image: nginx:alpine

Than you have to also adjust the matomo.conf file. In this case, change the first part into:

upstream php-handler {
    server my-matomo-app:9000;
}

The important thing is that my-matomo-app has to be the same service name as defined in your docker-compose.yml file.

m1d1 commented 3 years ago

None of the above infos worked for me. I was stuck with the port 9000 message. Here's how I fixed it:

Add to the end of the block for app: and web:

networks:
      - backend

Add as suggested by @renepardon to web:

depends_on:
      - app

Add to the end of the compose file

networks:
  backend:
    driver: bridge