Docker nginx reverse proxy gives “502 Bad Gateway”

I fixed it! I set the server name in different server blocks in nginx config. Remember to use docker port, not host port.

server {

  listen 80;
  server_name game2048;

  location / {
    proxy_pass "http://game2048:8080";
  }

}

server {

  listen 80;
  server_name game;

  location / {
    # Remember to refer to docker port, not host port
    # which is 9999 in this case:
    proxy_pass "http://game:8080";
  }

}

The github repo has been updated to reflect the fix, the old readme file is there under ./README.old01.md.

Typical that I find the answer when I carefully phrase the question to others. Do you know that feeling?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)