简体   繁体   English

在 nginx 中通过 certbot 安装 ssl 证书后网站关闭

[英]website down after installing ssl certificate through certbot in nginx

Below is my nginx configuration.下面是我的 nginx 配置。 I modified the 'default' file (which is placed at 'sites-available).我修改了“默认”文件(位于“可用站点”中)。 I am able to access the website when it's through 'http'.我可以通过“http”访问该网站。 But when I try through 'https', there is a connection time out and the page cannot be reached.但是当我尝试通过“https”时,连接超时并且无法访问该页面。 Nginx is strangely not making any entries to the logs(both access.log and error.log). Nginx 奇怪地没有在日志中输入任何条目(包括 access.log 和 error.log)。 I am seeking for help since I am completely new to this.我正在寻求帮助,因为我对此完全陌生。

# 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 port opened in aws ec2在 aws ec2 中打开 443 端口

After two days of never ending debegging, I understood the problem.经过两天无休止的调试,我明白了这个问题。 I had not opened 443 port in EC2 security group.我没有在 EC2 安全组中打开 443 端口。 Things to keep in mind whomever struggling with a similar issue -> Ensure that your OS firewall allows connections through 443 also ensure that your instance allows connections through 443.遇到类似问题的人要记住的事情->确保您的操作系统防火墙允许通过 443 进行连接,同时确保您的实例允许通过 443 进行连接。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM