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

Question - Usage with IP address (without the domain) for a service #16

Open
atulmy opened this issue Jan 1, 2020 · 1 comment
Open

Comments

@atulmy
Copy link

atulmy commented Jan 1, 2020

I've the following additional 3 services with following configuration:

version: "3"

volumes:
  CONFD:
  VHOSTD:
  NGINX-HTML:

services:
  nginx:
    image: nginx
    ports:
      - 80:80
      - 443:443
      - 5000:5000
    ...

  nginx-gen:
    image: jwilder/docker-gen
    ...

  letsencrypt-nginx-proxy-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion
    ...

  api:
    image: api
    build: ./api
    expose:
    	- 3000
    environment:
      - VIRTUAL_HOST=api.example.com
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=3000
      - LETSENCRYPT_HOST=api.example.com
      - [email protected]

  web:
    image: web
    build: ./web
    expose:
    	- 4000
    environment:
      - VIRTUAL_HOST=web.example.com
      - VIRTUAL_NETWORK=nginx-proxy
      - VIRTUAL_PORT=4000
      - LETSENCRYPT_HOST=web.example.com
      - [email protected]

  admin:
    restart: always
    image: admin
    build: ./admin
    expose:
    	- 5000

I want to map domains to api and web, however for admin, I'd just like to run it on IP:PORT (eg: http://178.10.10.5:5000)

Is there a way to do this?

The default.conf should contain following to make it work:

# rest of automatically generated nginx code by nginx.tmpl

upstream admin {
  server admin:5000;
}
server {
  listen 5000;
  listen [::]:5000;
  location / {
    proxy_pass http://admin;
  }
}

Any help would be highly appreciated!

@atulmy atulmy changed the title Question Question - Usage with IP address (without the domain) for a service Jan 1, 2020
@atulmy
Copy link
Author

atulmy commented Jan 3, 2020

CC: @gilyes, just wanted to get your help on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant