SSL issue in django web application

I am working on a django web application in python and I use docker containers. My ssl certificate has expired and I want to get a signed certificate from a domain such as go daddy. I tried to use a self signed certificate but I am not able to redirect the website to https. Even though I added reverse proxy in my nginx.conf file to listen to port 80 and 443.

Has anyone worked on this before and I will share more details on the same.

i have this in my app.conf file

server {
    listen 80;
    server_name appliication.com www.application.com Ip address 0.0.0.0;

    location /.well-known/acme-challenge/ {
    root /var/www/certbot;
    }

    location / {
        return 301 https://$host$request_uri;
    }    
}

server {
    listen 443 ssl;
    server_name appliication.com www.appliication.com Ip address 0.0.0.0;

    ssl_certificate /etc/path to key; #.crt
    ssl_certificate_key /etc/path to key; #.pem

    location / {
        proxy_pass http://backend:8000; #for demo purposes
    }
}

in my docker-compose.yml file I have the below code

services:
  nginx:
    image: nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./app.conf:/etc/nginx/conf.d/default.conf
      - /path/to/your/certificate.pem:/etc/ssl/certs/your_certificate.pem
      - /path/to/your/private.key:/etc/ssl/private/your_private.key

i am not sure where I am going wrong. can anyone help with this

Вернуться на верх