Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PavanYadala opened this issue Oct 4, 2019 · 4 comments · May be fixed by #188
Open

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

PavanYadala opened this issue Oct 4, 2019 · 4 comments · May be fixed by #188

Comments

@PavanYadala
Copy link

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
Copy link

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
Copy link

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

@FiveBoroughs FiveBoroughs linked a pull request Feb 23, 2020 that will close this issue
@mhellmeier
Copy link

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
Copy link

m1d1 commented Jun 28, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants