Trouble scaling docker container

I have a dockerized flask app which has the following structure

code_docker
├── docker-compose.yml
├── micr
│   ├── app.py
│   ├── Dockerfile
│   ├── requirements.txt
│   └── templates
│       └── index.html
├── nginx
│   ├── Dockerfile
│   └── nginx.conf
└── README.md

I am using nginx as a load balancer, The code inside docker-compose.yml and nginx.conf are mentioned below

docker-compose.yml

version: '3'

services:

  nginx:
    container_name: nginx
    build: ./nginx
    restart: always
    deploy:
      restart_policy:
        condition: on-failure
    ports:
      - "8540:8540"
    depends_on:
      - micr

  micr:
    build: ./micr
    restart: always 
    deploy: 
      resources:
        limits:
          cpus: '0.50' # 50% of available processing time (CPU)
          memory: 50M  # 50M of memory
        reservations:
          cpus: '0.25'
          memory: 20M
      restart_policy:
        condition: on-failure   
    expose:
      - "8530"
    command: gunicorn -w 1 -b :8530 app:app

nginx.conf

user nginx;

worker_processes 4;

events {
	worker_connections 1024;
}

http {
	keepalive_timeout 15;
	
	server {
		listen 8540;
		server_name localhost;

		location / {
			proxy_pass http://localhost:8530;
			#proxy_redirect off;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_set_header X-Forward-Host $server_name;
		}
	}
}

I can issue the below command to scale the container without any problem as can be seen from the message

$ docker-compose up --scale micr=4

But when I try to access them I get this error