Docker nginx reverse proxy does not work as expected

I’ve been following the nginx reverse proxy setup: https://www.freecodecamp.org/news/docker-nginx-letsencrypt-easy-secure-reverse-proxy-40165ba3aee2/

Details:

I have plex running with docker on port 32400. which I can hit with: curl localhost:32400

I then have my nginx image running based on the tutorial and setup my plex.conf file inside of nginx and restarted my nginx instance in docker.

However, whenever I curl with the plex.example.com the url is not redirected to my localhost url. Any help would be greatly appreciated.

docker-compose nginx sample:


  nginx:
    container_name: reverse 
    hostname: reverse 
    image: nginx
    ports:
       - 80:80
       - 443:443
    volumes:
      - ./config:/etc/nginx
      - ./certs:/etc/ssl/private

plex.conf sample for nginx

upstream plex {
  server        plex:32400;
}

server {
  listen        80;
  server_name   plex.example.com;

  location / {
    proxy_pass  http://plex;
  }
}

1 Like

Did you try localhost:32400 or 127.0.0.1:32400 instead of plex:32400 ?

Yes, I have tried to use localhost and 127.0.0.1 instead of plex for the server definition inside of the upstream.

Did you find a solution to this? I have the same problem and have been trying to fix it for ages. Can’t find anything. :expressionless:

Yeah I was able to find a solution. I’ll share part of my configuration file that helped with this when I get on a computer