大网数据广告活动
服务器运维问答

Why am I unable to access my website after installing an SSL certificate using Certbot? (running Ubuntu and Nginx)

· 52CE 我爱测

I can not establish a connection to port 443 on my nginx server. I needed port 443 to enable https connections, I used certbot to install an ssl certificate, and I went with the default installation, and default instructions in t…

问题原文

原帖链接 · momomo · CC BY-SA 4.0

I can not establish a connection to port 443 on my nginx server.

I needed port 443 to enable https connections, I used certbot to install an ssl certificate, and I went with the default installation, and default instructions in this guide

Even though I've set the 'nginx full' command to open both http and https ports, I double checked to make sure that port 443 is really open by running the following command sudo lsof -i -P -n | grep LISTEN, and in the response, I got port 443 as being used by nginx

I tried tools like cURL to test my ports, port 80 works just fine, but I get no response from port 443

I lack experience with server administration and I tried to check other resources but I don't know what else to do.

my sites-available configuration:

server {

        root /var/www/muhammed-aldulaimi.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name muhammed-aldulaimi.com www.muhammed-aldulaimi.com;

        location / {
                try_files $uri $uri/ =404;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/muhammed-aldulaimi.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/muhammed-aldulaimi.com/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.muhammed-aldulaimi.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = muhammed-aldulaimi.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        listen [::]:80;

        server_name muhammed-aldulaimi.com www.muhammed-aldulaimi.com;
    return 404; # managed by Certbot

}

ufw status:

22/tcp                     ALLOW       Anywhere
Nginx Full                 ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)

已采纳解答

原帖链接 · momomo · CC BY-SA 4.0

After verifying that there was no issue in ubuntu's firewall settings, I assumed that the issue lied in the web host itself. I was using AWS Lightsail, and turned out that Lightsail only accepted connections coming from port 22 and 80. Adding a rule that accepted other ports in the Networking tab; solved my issue.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-09-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。