acme-companion icon indicating copy to clipboard operation
acme-companion copied to clipboard

nginx upstream errror with wordpress container

Open seking01 opened this issue 3 years ago • 4 comments
trafficstars

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.

seking01 avatar Mar 18 '22 10:03 seking01

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>"

casi avatar May 31 '22 15:05 casi

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

arnold-maderthaner avatar Jun 04 '22 13:06 arnold-maderthaner

@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 avatar Jul 14 '22 00:07 webguywalker

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.

webguywalker avatar Jul 14 '22 01:07 webguywalker