Docker Community Forums

Share and learn in the Docker community.

Nginx-proxy problem

Been trying to get nginx-proxy working. I have two docker-compose files and docker-compose up works fine and no errors in the logs but when I go to the URL I get the nginx welcome page, not the website I am expecting.

docker-compose.yml (proxy)

version: ‘3.5’

services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- “80:80”
- “443:443”
volumes:
- html:/usr/share/nginx/html
- dhparam:/etc/nginx/dhparam
- vhost:/etc/nginx/vhost.d
- certs:/etc/nginx/certs:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
labels:
- “com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy”

letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-proxy-lets-encrypt
depends_on:
- “nginx-proxy”
volumes:
- certs:/etc/nginx/certs:rw
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro

volumes:
certs:
html:
vhost:
dhparam:

networks:
default:
external:
name: nginx-proxy

docker-compose.yml (wordpress)

version: “3.5”

services:
db_node_domain:
image: mysql:5.7
volumes:
- ./db:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: xxxx
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: xxxx
container_name: wordpress_db

wordpress:
depends_on:
- db_node_domain
image: wordpress:latest
volumes:
- ./html:/var/www/html
expose:
- 80
restart: always
environment:
VIRTUAL_HOST: domoin.tld
WORDPRESS_DB_HOST: db_node_domain:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: xxxx
container_name: wordpress

networks:
default:
external:
name: nginx-proxy

logfile (proxy)

Creating nginx-proxy … done
Creating nginx-proxy-lets-encrypt … done
Attaching to nginx-proxy, nginx-proxy-lets-encrypt
nginx-proxy | Custom dhparam.pem file found, generation skipped
nginx-proxy | forego | starting dockergen.1 on port 5000
nginx-proxy | forego | starting nginx.1 on port 5100
nginx-proxy | dockergen.1 | 2019/04/29 04:30:15 Generated ‘/etc/nginx/conf.d/default.conf’ from 1 containers
nginx-proxy | dockergen.1 | 2019/04/29 04:30:15 Running ‘nginx -s reload’
nginx-proxy | dockergen.1 | 2019/04/29 04:30:15 Error running notify command: nginx -s reload, exit status 1
nginx-proxy | dockergen.1 | 2019/04/29 04:30:15 Watching docker events
nginx-proxy | dockergen.1 | 2019/04/29 04:30:15 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ‘nginx -s reload’
nginx-proxy | dockergen.1 | 2019/04/29 04:30:16 Received event start for container 7451fb436c7e
nginx-proxy | dockergen.1 | 2019/04/29 04:30:16 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ‘nginx -s reload’
nginx-proxy-lets-encrypt | Info: Custom Diffie-Hellman group found, generation skipped.
nginx-proxy-lets-encrypt | Reloading nginx proxy (0fcefb3e12d4f7537831fac213c164607ca8e29f8f63f563e74f1f07b74b96a4)…
nginx-proxy-lets-encrypt | 2019/04/29 04:30:16 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ‘’
nginx-proxy-lets-encrypt | 2019/04/29 04:30:16 [emerg] 65#65: PEM_read_bio_DHparams("/etc/nginx/dhparam/dhparam.pem") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: DH PARAMETERS)
nginx-proxy-lets-encrypt | 2019/04/29 04:30:16 Generated ‘/app/letsencrypt_service_data’ from 2 containers
nginx-proxy-lets-encrypt | 2019/04/29 04:30:16 Running ‘/app/signal_le_service’
nginx-proxy-lets-encrypt | 2019/04/29 04:30:16 Watching docker events
nginx-proxy-lets-encrypt | 2019/04/29 04:30:16 Contents of /app/letsencrypt_service_data did not change. Skipping notification ‘/app/signal_le_service’
nginx-proxy-lets-encrypt | Sleep for 3600s
nginx-proxy-lets-encrypt | 2019/04/29 04:30:30 Received event start for container f3314bddf1fc
nginx-proxy | dockergen.1 | 2019/04/29 04:30:30 Received event start for container f3314bddf1fc
nginx-proxy | dockergen.1 | 2019/04/29 04:30:30 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ‘nginx -s reload’
nginx-proxy-lets-encrypt | 2019/04/29 04:30:32 Received event start for container 8cddcd25f9e0
nginx-proxy | dockergen.1 | 2019/04/29 04:30:32 Received event start for container 8cddcd25f9e0
nginx-proxy | dockergen.1 | 2019/04/29 04:30:32 Generated ‘/etc/nginx/conf.d/default.conf’ from 4 containers
nginx-proxy | dockergen.1 | 2019/04/29 04:30:32 Running ‘nginx -s reload’
nginx-proxy | dockergen.1 | 2019/04/29 04:30:32 Error running notify command: nginx -s reload, exit status 1
nginx-proxy-lets-encrypt | 2019/04/29 04:30:47 Debounce minTimer fired
nginx-proxy-lets-encrypt | 2019/04/29 04:30:47 Contents of /app/letsencrypt_service_data did not change. Skipping notification ‘/app/signal_le_service’
nginx-proxy | nginx.1 | 82.29.57.180 - - [29/Apr/2019:04:31:02 +0000] “GET / HTTP/1.1” 200 612 “-” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0” “-”
nginx-proxy | nginx.1 | 2019/04/29 04:31:02 [error] 36#36: *2 open() “/usr/share/nginx/html/favicon.ico” failed (2: No such file or directory), client: 82.29.57.180, server: localhost, request: “GET /favicon.ico HTTP/1.1”, host: “domain.tld
nginx-proxy | nginx.1 | 82.29.57.180 - - [29/Apr/2019:04:31:02 +0000] “GET /favicon.ico HTTP/1.1” 404 169 “-” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0” “-”

logifle (wordpress)

Creating wordpress_db … done
Creating wordpress … done
Attaching to wordpress_db, wordpress
wordpress_db | 2019-04-29T04:30:31.172521Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
wordpress_db | 2019-04-29T04:30:31.173851Z 0 [Note] mysqld (mysqld 5.7.26) starting as process 1 …
wordpress_db | 2019-04-29T04:30:31.176006Z 0 [Note] InnoDB: PUNCH HOLE support available
wordpress_db | 2019-04-29T04:30:31.176020Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
wordpress_db | 2019-04-29T04:30:31.176023Z 0 [Note] InnoDB: Uses event mutexes
wordpress_db | 2019-04-29T04:30:31.176025Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
wordpress_db | 2019-04-29T04:30:31.176044Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
wordpress_db | 2019-04-29T04:30:31.176047Z 0 [Note] InnoDB: Using Linux native AIO
wordpress_db | 2019-04-29T04:30:31.176254Z 0 [Note] InnoDB: Number of pools: 1
wordpress_db | 2019-04-29T04:30:31.176362Z 0 [Note] InnoDB: Using CPU crc32 instructions
wordpress_db | 2019-04-29T04:30:31.177658Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
wordpress_db | 2019-04-29T04:30:31.183331Z 0 [Note] InnoDB: Completed initialization of buffer pool
wordpress_db | 2019-04-29T04:30:31.184933Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
wordpress_db | 2019-04-29T04:30:31.196032Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
wordpress_db | 2019-04-29T04:30:31.233776Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
wordpress_db | 2019-04-29T04:30:31.233911Z 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
wordpress_db | 2019-04-29T04:30:31.484046Z 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
wordpress_db | 2019-04-29T04:30:31.486264Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
wordpress_db | 2019-04-29T04:30:31.486294Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
wordpress_db | 2019-04-29T04:30:31.489219Z 0 [Note] InnoDB: 5.7.26 started; log sequence number 12360513
wordpress_db | 2019-04-29T04:30:31.489649Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
wordpress_db | 2019-04-29T04:30:31.490048Z 0 [Note] Plugin ‘FEDERATED’ is disabled.
wordpress_db | 2019-04-29T04:30:31.493544Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190429 4:30:31
wordpress_db | 2019-04-29T04:30:31.500778Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
wordpress_db | 2019-04-29T04:30:31.501472Z 0 [Warning] CA certificate ca.pem is self signed.
wordpress_db | 2019-04-29T04:30:31.507102Z 0 [Note] Server hostname (bind-address): ‘*’; port: 3306
wordpress_db | 2019-04-29T04:30:31.508149Z 0 [Note] IPv6 is available.
wordpress_db | 2019-04-29T04:30:31.508188Z 0 [Note] - ‘::’ resolves to ‘::’;
wordpress_db | 2019-04-29T04:30:31.508229Z 0 [Note] Server socket created on IP: ‘::’.
wordpress_db | 2019-04-29T04:30:31.514561Z 0 [Warning] Insecure configuration for --pid-file: Location ‘/var/run/mysqld’ in the path is accessible to all OS users. Consider choosing a different directory.
wordpress_db | 2019-04-29T04:30:31.531562Z 0 [Note] Event Scheduler: Loaded 0 events
wordpress_db | 2019-04-29T04:30:31.531767Z 0 [Note] mysqld: ready for connections.
wordpress_db | Version: ‘5.7.26’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 MySQL Community Server (GPL)
wordpress | AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.19.0.5. Set the ‘ServerName’ directive globally to suppress this message
wordpress | AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 172.19.0.5. Set the ‘ServerName’ directive globally to suppress this message
wordpress | [Mon Apr 29 04:30:32.304417 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.17 configured – resuming normal operations
wordpress | [Mon Apr 29 04:30:32.304464 2019] [core:notice] [pid 1] AH00094: Command line: ‘apache2 -D FOREGROUND’

I’ve got mine working. I think you might just need to add the VIRTUAL_HOST and LETSENCRYPT_HOST fields to the wordpress docker-compose file in the environment section. I added my domains like this: LETSENCRYPT_HOST: domain.com, www.domain.com.

Let me know if that was it.

I’m currently struggling to get the HTTPS to work.