Running docker nginx container fails without warnings or errors

Viewed 1637

I'm trying to run a NGINX container which by the looks of it starts without a problem but when trying access any page its suppose to host I'm "Unable to connect" it doesn't give the usual NGINX welcome or NGINX error.

When starting it I get the following logs:

$ sudo docker-compose up
Starting production_nginx ... done
Attaching to production_nginx
production_nginx | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
production_nginx | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
production_nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
production_nginx | 10-listen-on-ipv6-by-default.sh: /etc/nginx/conf.d/default.conf is not a file or does not exist, exiting
production_nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
production_nginx | /docker-entrypoint.sh: Configuration complete; ready for start up

My docker-compose.yml looks like this:

version: "3.7"
services:
  nginx:
    image: nginx:latest
    container_name: production_nginx
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /etc/letsencrypt/:/etc/letsencrypt/
      - /opt/nginx_cache/:/opt/nginx_cache/
      - /var/home/core/docker/nginx/dhparam.pem:/etc/nginx/dhparam.pem
      - /var/home/core/docker/nginx/conf.d/:/etc/nginx/conf.d/
      - /var/home/core/docker/files/:/var/home/core/docker/files/
      - /var/home/core/docker/nginx/nginx.conf:/etc/nginx/nginx.conf
      - /var/log/nginx/:/var/log/nginx/:Z
    networks:
      - proxynet
      - abnet
      - dsnet

networks:
  proxynet:
    name: source_network
  abnet:
    name: one_network
  dsnet:
    name: two_network

I have entered the shell of the NGINX container and tested the config files which all passes the test.

What else could cause this problem?

EDIT adding nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    include /etc/nginx/conf.d/*.conf;

    client_max_body_size 50M;
    client_body_buffer_size 50M;

    ssl_session_timeout  10m;
    ssl_ecdh_curve secp384r1;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;

    ssl_stapling on;
    ssl_stapling_verify on;

    proxy_cache_path /opt/nginx_cache levels=1:2 keys_zone=nginx_cache:60m max_size=300m inactive=24h;
    proxy_cache_key "$scheme$request_method$host$request_uri";
    proxy_cache_methods GET HEAD;
}
0 Answers
Related