Closed
Description
I am working on running my application over https using nginx and the letsencrypt-nginx-proxy-companion images, but I am experiencing some weird results. My docker-compose.yml looks like this:
version: '2.2'
services:
ignite-api:
restart: always
build: ./ignite-api
ports:
- "8000"
links:
- postgres:postgres
- rabbit:rabbit
- worker:worker
volumes:
- /usr/src/app/
- /usr/src/app/static
env_file: .env
command: /usr/local/bin/gunicorn api.wsgi:application -w 2 -b :8000 --reload
networks:
- api-net
- nginx-proxy
environment:
VIRTUAL_PORT: 8000
VIRTUAL_HOST: ignite-api.local
LETSENCRYPT_HOST: example.com
LETSENCRYPT_EMAIL: example@email.com
postgres:
...
rabbit:
...
worker:
...
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- "./nginx/vhost.d:/etc/nginx/vhost.d"
- "./nginx/html:/usr/share/nginx/html"
- "./nginx/certs:/etc/nginx/certs"
- "/var/run/docker.sock:/tmp/docker.sock:ro"
networks:
- nginx-proxy
letsencrypt-nginx-proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes_from:
- "nginx-proxy"
networks:
- nginx-proxy
volumes:
pgdata:
driver: local
rabbitmqdata:
driver: local
networks:
nginx-proxy:
external:
name: nginx-proxy
api-net:
driver: bridge
When running docker-compose logs nginx-proxy
everything seems to be working fine with the following logs:
nginx-proxy_1 | WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one
nginx-proxy_1 | is being generated in the background. Once the new dhparam.pem is in place, nginx will be reloaded.
nginx-proxy_1 | forego | starting dockergen.1 on port 5000
nginx-proxy_1 | forego | starting nginx.1 on port 5100
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:30:58 Generated '/etc/nginx/conf.d/default.conf' from 3 containers
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:30:58 Running 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:30:58 Watching docker events
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:30:59 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:30:59 Received event start for container c305e8685566
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:30:59 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:02 Received event start for container f98262bb33da
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:02 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:06 Received event start for container 9e22795bbfd1
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:07 Generated '/etc/nginx/conf.d/default.conf' from 6 containers
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:07 Running 'nginx -s reload'
nginx-proxy_1 | 2018/01/06 17:31:26 [notice] 92#92: signal process started
nginx-proxy_1 | Generating DH parameters, 2048 bit long safe prime, generator 2
nginx-proxy_1 | This is going to take a long time
nginx-proxy_1 | dhparam generation complete, reloading nginx
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:58 Received event start for container 4890d509bda7
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:58 Received event die for container 4890d509bda7
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:59 Generated '/etc/nginx/conf.d/default.conf' from 6 containers
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:31:59 Running 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:32:00 Received event start for container 4890d509bda7
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:32:00 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:32:00 Received event die for container 4890d509bda7
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:32:01 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx-proxy_1 | dockergen.1 | 2018/01/06 17:32:01 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
However when inspecting the default nginx config, it does not seem like it has been configured at all... (command docker-compose run nginx-proxy cat /etc/nginx/conf.d/default.conf
)
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Any request to the domain also fails, although it is now served over https!
Any idea of what I might have gotten wrong here?
Thank you very much!
Metadata
Metadata
Assignees
Labels
No labels