nginx-proxy / nginx-proxy/nginx-proxy

Proxying to a second nginx container

Open
#664 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
19.9k
Forks
3k
Avg merge
2d 11h
Merged PRs (30d)
1

Description

I generally have 3 or 4 separate local dev envs for Drupal development and now that I'm moving from a native local environment to docker (based on docker4drupal) I'm trying to use nginx-proxy proxy URLs like dev.d7 and dev.d8 but I can't anything to work.

I have a docker-composer.json just for nginx-proxy in the root of my ~/Sites directory:

version: "2"

services:
  # Create a revers proxy to sit in front of local dev sites
  nginx-proxy:
    image: jwilder/nginx-proxy
    #net: d8_default
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: always

Then in my ~/Sites/d8 folder I have a separate docker-composer.json based on the docker-composer.json included in docker4drupal:

version: "2"

services:
  mariadb:
    image: wodby/drupal-mariadb:1.0.0
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: 1
      MYSQL_DATABASE: drupal
      MYSQL_USER: drupal
      MYSQL_PASSWORD: drupal

  php:
    image: wodby/drupal-php:7.0-1.0.0
#    image: wodby/drupal-php:5.6-1.0.0
    environment:
      PHP_SITE_NAME: dev
      PHP_HOST_NAME: localhost:8000
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
    volumes:
      - ./:/var/www/html

  nginx:
    image: wodby/drupal-nginx:1.0.0
    environment:
      VIRTUAL_HOST: dev.d8
      NGINX_SERVER_NAME: localhost
      NGINX_UPSTREAM_NAME: php
#      NGINX_DOCROOT: web # Relative path inside the /var/www/html/ directory.
      DRUPAL_VERSION: 8 # Allowed: 7, 8.
    volumes_from:
      - php
 #   ports:
 #     - "8000:80"
 #   networks:
 #     - nginx-proxy

  pma:
    image: phpmyadmin/phpmyadmin
    environment:
      PMA_HOST: mariadb
      PMA_USER: drupal
      PMA_PASSWORD: drupal
      PHP_UPLOAD_MAX_FILESIZE: 1G
      PHP_MAX_INPUT_VARS: 1G
    ports:
     - "8001:80"

  mailhog:
    image: mailhog/mailhog
    ports:
      - "8002:8025"

I've tried all sorts of permutations of specifying ports, adding networks, exposing ports but I'm not able to browse http://dev.d8 (I get a DNS error: ERR_NAME_NOT_RESOLVED) ... Any help is hugely appreciated.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the separate root and d8 Docker Compose files, especially the nginx-proxy service, VIRTUAL_HOST setting, and commented network and port sections. Run both Compose projects and inspect their container connectivity and proxy behavior; done means http://dev.d8 resolves locally and serves the Drupal site.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, nginx
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.