nginx-proxy: 502 Bad Gateway on Centos 8

Is there something special we have to do to get it running on Centos 8?

I tried to run the basic docker-compose.yaml example from README

version: '2'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

  whoami:
    image: jwilder/whoami
    environment:
      - VIRTUAL_HOST=whoami.local

And I got:

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.19.3</center>
</body>
</html>

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 4
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I usually create a separate Docker network outside of Docker compose then use it as an external network in the compose file.

docker network create nginx-proxy

then

version: '3'

services:
  nginx:
    [...]
    networks:
      - nginx-proxy

# Do not forget to 'docker network create nginx-proxy' before launch
# and to connect the proxied containers to the nginx-proxy network.

networks:
  nginx-proxy:
    external: true

Repeated in every compose file for services that will be proxied.

Also take a look at https://github.com/buchdag/letsencrypt-nginx-proxy-companion-compose

Did you try to enabling masquerading in CentOS 8?

I did not. I just switched to Traefik.