Home > database >  This site can’t be reached domain.de refused to connect after changing http to https in Nginx
This site can’t be reached domain.de refused to connect after changing http to https in Nginx

Time:11-15

I have a project, Frontend with Flutter and Backend with Django. It was working fine. I wanted to change HTTP to HTTPs. now I am getting the error This site can’t be reached domain.de refused to connect The Nginx file for the Frontend:

server {
        server_name visoon.de;
        root /home/visoon_frontend/build/web;
        index index.html;
    listen 443 ssl; 
    ssl_certificate /etc/letsencrypt/live/visoon.de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/visoon.de/privkey.pem; 
    include /etc/letsencrypt/options-ssl-nginx.conf; 
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
    if ($host = visoon.de) {
        return 301 https://$host$request_uri;
    } 
        listen 80;
        server_name visoon.de;
    return 404; 
}

And Nginx file for the Backend:

upstream visoon_app_server {
  server unix:/home/visoon_backend/run/gunicorn.sock fail_timeout=0;
}

server {
    listen   80;
    server_name visoon.de;
    client_max_body_size 4G;
    proxy_read_timeout 1200s;
    access_log /home/visoon_backend/logs/nginx-access.log;
    error_log /home/visoon_backend/logs/nginx-error.log;
    location /static/ {
        alias   /home/visoon_backend/visoon_backend/static/;
        expires -1;
    }
    location /media/ {
        alias   /home/visoon_backend/visoon_backend/static/media/;
        expires -1;
    }
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        # proxy_buffering off;
        if (!-f $request_filename) {
            proxy_pass http://visoon_app_server;
            break;
        }
    }

    # Error pages
    error_page 500 502 503 504 /500.html;
    location = /500.html {
        root /home/visoon_backend/visoon_backend/static/;
    }
}

Does anyone know why I am getting this error?

CodePudding user response:

After searching for a couple of hours, I discovered that port 443 wasn't accessible on the server.

  • Related