Docker Swarm - PHP-FPM not working with Nginx running on manager

one text

Solution:

I had the similar kind of issue and the solution was to use the docker service name in upstream.

Here is my setup

  • 3 EC2 with Docker Swarm
  • 1 Swarm Manager ( Nginx proxy deployed )
  • 2 Swarm Worker (Frontend + backend deployed)

Flow
Browser ->> Nginx-proxy ->> React-frontend (Nginx) ->> Go-backend

nginx.conf

http {
    
    upstream allbackend {
        server exam105_frontend:8080; #FrontEnd Service Name
    } 

    server {
        listen 80;

        location / {

              proxy_pass http://allbackend;
        }
    }

}

Docker Swarm Services

enter image description here

AWS Note:

Remember to open port 80 publicly and 8080 (or whatever port number you are using) for internal communication in Security Group of your AWS setup, otherwise you won't be able to access the service.

Source