【问题标题】:website down after installing ssl certificate through certbot in nginx在 nginx 中通过 certbot 安装 ssl 证书后网站关闭
【发布时间】:2022-01-24 21:11:06
【问题描述】:

下面是我的 nginx 配置。我修改了“默认”文件(位于“可用站点”中)。我可以通过“http”访问该网站。但是当我尝试通过“https”时,连接超时并且无法访问该页面。 Nginx 奇怪地没有在日志中输入任何条目(包括 access.log 和 error.log)。我正在寻求帮助,因为我对此完全陌生。

# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.

##

# Default server configuration
#
server {
    listen 80;
    listen [::]:80;

    root /var/www/main.x.com/html;

    
    index index.html

    server_name main.x.com;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

}


server {
    listen 443 ssl;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_certificate /etc/letsencrypt/live/main.x.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/main.x.com/privkey.pem;

    server_name main.x.com;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    location / {
        root /var/www/main.x.com/html;
        index index.html;
    }
}

【问题讨论】:

  • 您确定连接到端口 443 的连接没有被服务器上的某种防火墙阻止吗?
  • @IvanShatsky 防火墙的状态为非活动状态(sudo ufw status)

标签: nginx ssl https backend certbot


【解决方案1】:

在 aws ec2 中打开 443 端口

经过两天无休止的调试,我明白了问题所在。我没有在 EC2 安全组中打开 443 端口。遇到类似问题的人要记住的事情 -> 确保您的操作系统防火墙允许通过 443 进行连接,同时确保您的实例允许通过 443 进行连接。

【讨论】:

    猜你喜欢
    • 2019-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-19
    • 2018-01-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多