0

I have a docker with 2 containers for serving individual sites and jwilder/nginx-proxy in front of them.

However I'm only getting the default nginx page, so the vhosts aren't routing correctlty.

I've used https://www.rent-a-hero.de/wp/2017/06/09/use-j-wilders-nginx-proxy-for-multiple-docker-compose-projects/ as a guide t get myself started on this, because I wanted to set up a proxy network.

Each of the serving nxinx containers has a vhost file, and uses a 4th, shared php container (the code is the same in both nginx containers).

$ docker run -d \
    --name nginx-proxy \
    -p 80:80 \
    --network=nginx-proxy \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    jwilder/nginx-proxy

/docker-compose.yml

version: '2'
services:
    app-admin:
        image: nginx:latest
        container_name: app-admin
        environment:
            VIRTUAL_HOST: admin.app.local
            VIRTUAL_PORT: 80
        volumes:
            - .:/var/www/html
            - admin.app.conf:/etc/nginx/vhost.d/admin.app.local:ro
        links:
            - php
    php:
        image: php:7-fpm
        container_name: php
        volumes:
            - .:/var/www/html
networks:
    default:
        external:
            name: nginx-proxy

/admin.app.conf:

server {
    server_name admin.app.local
    listen 80;
    listen [::]:80;
    root /var/www/html;
    index index.html index.php;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ /\.ht {
        deny  all;
    }
}

app.conf is essentially the same for this testing stage... same result

Original files edited to help simplify the question (the removed files just basically setup the required nginx-proxy container and network, and I;ve stripped out the example second nginx container)

vim
  • 45
  • 1
  • 9
  • try to reduce your case to a minimal example that doesn't work. That way you may find where is the issue. – Sebastian Feb 11 '19 at 15:38
  • I found one issue: the server_name part of vhost.conf file needed a semi-colon at the end (DOH), although the docker still doesn't route to the vhost – vim Feb 20 '19 at 06:24

0 Answers0