0

I am trying to setup via docker-compose an NGINX webserver as a reverse proxy but I am not able to get it run :(

Here is my nginx config file:

worker_processes 1;

events { worker_connections 1024; }

http {

    sendfile on;

    upstream docker-frontend-tier-one {
        server fe-tier-one:80;
    }

    server {
        listen 8081;

        location / {
            proxy_pass         http://docker-frontend-tier-one;
            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-Forwarded-Host $server_name;
        }
    }
}

... and here is my compose file:

version: '3.7'

services:

  nginx-proxy:
    image: nginx-proxy:latest
    restart: always
    container_name: nginx-proxy
    ports:
      - 8081:8081
    networks:
      - front-tier

  fe-tier-one:
    image: fe-tier-one-image:latest
    restart: always
    container_name: fe-tier-one
    depends_on:
      - nginx-proxy
    expose:
      - "80"
    networks:
      - front-tier

networks:
  front-tier:
    driver: bridge

So after all is setup and composed up I am not able to see something when I enter: http://localhost:8081

The fe-tier-one-image contains an angular app also running in an nginx webserver via docker ... I can access directly to the container but not the proxy_pass-way

Later I want to add several other frontend app by using the reverse proxy for routing.

Any help?

1 Answer 1

0

This may not be a direct answer to your question - but you could consider using the following docker image, which has a nice web interface also. https://github.com/jc21/nginx-proxy-manager

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.