Nginx error: connect() failed (111: Connection refused) while connecting to upstream

How to redirect subdomain.domain.com to localhost port 1234?
Before I used apache with this config:

<VirtualHost *:8080> 
    ServerAdmin admin@domain.com
    ServerName subdomain.domain.com
    ProxyPreserveHost On
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:1234/
    ProxyPassReverse / http://localhost:1234/
</VirtualHost>

Now on new server I would like to do the same with jwilder/nginx-proxy:alpine with docker-compose.
docker-compose.yml:

my_app:
    image: nginx:alpine
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - ./my_app/subdomain.domain.com.conf:/etc/nginx/conf.d/zzzz_subdomain.domain.com.conf:ro
    environment:
      - VIRTUAL_HOST=subdomain.domain.com
    networks:
      - proxy-tier
    restart: unless-stopped

subdomain.domain.com.conf:

server {
        server_name subdomain.domain.com;
        listen       80;
        location / {
            proxy_pass   http://host.docker.internal:1234/;
        }
    }

But with this setup i am getting:

[error] 35#35: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 172.23.0.3, server: subdomain.domain.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.17.0.1:1234/favicon.ico", host: "subdomain.domain.com", referrer: "http://subdomain.domain.com/dss/aform.jsp"

from host following works correct:

curl http://localhost:1234
telnet localhost 1234

but from inside docker:

curl host.docker.internal:1234
telnet host.docker.internal 1234

it gives “Connection refused” error.

I found solution. The problem was that port was accessible only from localhost.

netstat -tulpn

should show something like 0.0.0.0:1234
That means it is accessible from all interfaces