flutter 无法访问此站点domain.de在Nginx中将http更改为https后拒绝连接

wn9m85ua  于 2022-11-17  发布在  Flutter
关注(0)|答案(1)|浏览(185)

我有一个项目,前端有Flutter,后端有Django。它运行得很好。我想把HTTP改为HTTPs。现在我得到了错误This site can’t be reached domain.de refused to connect前端的Nginx文件:

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

和后端的Nginx文件:

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

有人知道为什么我会收到这个错误吗?

zujrkrfu

zujrkrfu1#

在搜索了几个小时后,我发现服务器上的端口443不可访问。

相关问题