无法使用https访问网站

时间:2020-03-09 10:10:10

标签: ssl nginx

我目前正在使用具有以下配置的nginx为服务器提供服务。

server {
    server_name www.skipven.xyz skipven.xyz;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/ubuntu/ari-bot/aribot;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/ubuntu/ari-bot/ari-bot.sock;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/skipven.xyz/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/skipven.xyz/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
}

server {
    if ($host = www.skipven.xyz) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = skipven.xyz) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name www.skipven.xyz skipven.xyz;
    return 404; # managed by Certbot
}

当我尝试访问http://skipven.xyz时,它已成功重定向到https://skipven.xyz。但是https://skipven.xyz不返回任何内容。我也找不到https请求的任何访问日志,但是http请求像charm一样记录。

其他注意事项:

运行sudo nginx -t返回以下响应:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

运行sudo ufw status返回以下响应:

Status: active

To                         Action      From
--                         ------      ----
Nginx Full                 ALLOW       Anywhere                  
22/tcp                     ALLOW       Anywhere                  
Nginx Full (v6)            ALLOW       Anywhere (v6)             
22/tcp (v6)                ALLOW       Anywhere (v6) 

1 个答案:

答案 0 :(得分:1)

首先请确保您的Web应用程序正在运行,然后尝试卷曲到unix套接字。如果仍然无法使用,您现在使用哪种云服务?如果使用aws或gce,则仍需要配置其防火墙。

相关问题