Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how implementat load balance? #1364

Open
ghost opened this issue Dec 1, 2019 · 2 comments
Open

how implementat load balance? #1364

ghost opened this issue Dec 1, 2019 · 2 comments
Labels
kind/question Issue that might be transferred to Discussions

Comments

@ghost
Copy link

ghost commented Dec 1, 2019

Hi , I want implement load balance ,
I want to determine if this is correct ,
mutil container ( same VIRTUAL_HOST ), the VIRTUAL_PORT can be the same or different ,
like web , web2 container.
Is it as simple as implement load balancing?
tjank you.

version: '3.5'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy:alpine
    restart: always
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./html:/usr/share/nginx/html
      - dhparam:/etc/nginx/dhparam
      - ./vhost.d:/etc/nginx/vhost.d

  web:
    restart: always
    image: web
    depends_on:
      - db
    environment:
      - VIRTUAL_HOST=www.hello.com
      - VIRTUAL_NETWORK=nginx-proxy
      -  VIRTUAL_PORT=8087
    expose:
      - "8087"

  web2:
    restart: always
    image: web2
    depends_on:
      - db
    environment:
      - VIRTUAL_HOST=www.hello.com
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=8087
    expose:
      - "8087"

 .......

volumes:
  certs:
  html:
  dhparam:
  db-data:
@requizm
Copy link

requizm commented Aug 20, 2023

I think the only way is, changing default.conf of nginx container.

@buchdag buchdag added the kind/question Issue that might be transferred to Discussions label Dec 19, 2023
@aareman
Copy link

aareman commented Jun 24, 2024

There is now some form of experimental load balancing built-in. Checkout the docs here https://github.com/nginx-proxy/nginx-proxy/tree/main/docs#upstream-server-http-load-balancing-support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Issue that might be transferred to Discussions
Projects
None yet
Development

No branches or pull requests

3 participants