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 upstream errror with wordpress container #933

Open
seking01 opened this issue Mar 18, 2022 · 4 comments
Open

nginx upstream errror with wordpress container #933

seking01 opened this issue Mar 18, 2022 · 4 comments

Comments

@seking01
Copy link

hi, i try to run this in 3 container setup with a wordpress docker container but it does not work

this is my docker-compose file
`version: '2'

services:
db:
container_name: db
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress

wordpress:
container_name: wordpress
image: wordpress:latest

 restart: always

 environment:
   WORDPRESS_DB_HOST: db:3306
   WORDPRESS_DB_USER: root
   WORDPRESS_DB_PASSWORD: wordpress
   VIRTUAL_HOST: myurl.de
   LETSENCRYPT_HOST: myurl.de  

volumes:
db_data:
`

When i try to open myurl.de i get 502 BAD GATEWAY. In nginx container logs it says:
2022/03/18 10:20:55 [error] 267#267: *162 no live upstreams while connecting to upstream, client:

thank you for your help.

@casi
Copy link

casi commented May 31, 2022

The same with my Rails app. If I use docker run ... all containers work, but as soon as I use docker compose I get the same 502 message. With or without SSL.
I have a small Sinatra app running in another container. It only works there without docker compose too.

$ docker logs nginx-proxy:

nginx.1     | 2022/05/31 15:26:21 [error] 205#205: *129 no live upstreams while connecting to upstream, client: [...], server: <subdomain.domain.tld>, request: "GET / HTTP/2.0", upstream: "http://<subdomain.domain.tld>/", host: "<subdomain.domain.tld>"

@arnold-maderthaner
Copy link

same issue here - anyone has a solution for this or how to further debug ?

@webguywalker
Copy link

@seking01 @casi @arnold-maderthaner
TLDR; - I downgraded from nginx:alpine to nginx:1.20-alpine and it worked for me.

I'm not sure if this would help but I was setting this up a wordpress container as well and after a day or netstat, telnet, docker inspect, curl, reading nginx docs, and feeling like a docker failure I had a sanity check with myself and realized that maybe I wasn't doing anything wrong at all :) how about I just pin to a older version of nginx and boom it worked.

I first triednginx:alpine and got the same error you mentioned regarding no live upstreams then I downgraded to nginx:1.20-alpine and it worked. Being excited I also tried nginx:1.21-alpine , nginx:1.22-alpine, nginx:1.23-alpine and they worked as well.

Confusing part is nginx:alpine, nginx:1.23-alpine currently both are running nginx 1.23 so for kicks I retried nginx:alpine and it worked too 🤕 . I was suspecting something introduced in nginx 1.23 was the culprit but too tired to chase this ghost for now.

@webguywalker
Copy link

example compose file i'm using https://gist.github.com/webguywalker/3b6e699f2cbe8f7b814e904e8f0095d3

Note:
my actual setup is a but more complicated with multiple files, networks and etc. and I haven't tested that file specifically but hopefully it helps, update to fit your needs.

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

No branches or pull requests

4 participants