Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

456
Views
Nginx can't include options-ssl-nginx.conf in Docker

I'm trying to run my Nginx with HTTPS.

The problem appears when I'm loading this config line:

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

I have an error nginx: [crit] pread() "/etc/letsencrypt/options-ssl-nginx.conf" failed (21: Is a directory).

My docker-compose file:

version: '2.3'

services:
  db:
    extends:
      service: db
      file: db_only.yml

    env_file:
      - envs/testing.env

  backend:
    build: ../backend
    env_file:
      - envs/testing.env
    depends_on:
      - db
    ports:
      - "8000:8000"
    command: bash -c "python manage.py migrate && daphne -b 0.0.0.0 -p 8000 backend.asgi:application"
    volumes:
      - ../backend:/code


  frontend:
    extends:
      service: frontend
      file: local.yml

  nginx:
    image: nginx:latest
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ../backend/static:/backend_static/
      - ../backend/media:/media/
      - ../frontend/build/static:/static/
      - /etc/letsencrypt/:/etc/letsencrypt/
      - ./nginx/testing.conf:/etc/nginx/conf.d/domain.conf
    depends_on:
      - backend
      - frontend

My Nginx config:

client_max_body_size 100M;

upstream back {
  server backend:8000;
}

upstream front {
    server frontend;
}

server {
    listen 80;
    server_name domain;

    # redirects both www and non-www to https
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl; # managed by Certbot
    server_name domain;

    ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    gzip on;

    location /static/ {
        autoindex on;
        alias /static/;
    }

    location /backend_static/ {
        autoindex on;
        alias /backend_static/;
    }

    location /media/ {
        autoindex on;
        alias /media/;
    }

    location /api/ {
        proxy_set_header Host $host;
        proxy_pass https://back/api/;
    }

    location /admin/ {
        proxy_set_header Host $host;
        proxy_pass https://back/admin/;
    }

    location / {
        proxy_set_header Host $host;
        proxy_pass https://front;
    }

    #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;
    }
}

Could you tell me what's the point here? Thanks.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!