V
V
vlog2021-11-27 15:28:19
Nginx
vlog, 2021-11-27 15:28:19

Certbot: Site stopped loading after installing ssl, browser returns ERR_CONNECTION_TIMED_OUT. How to fix?

Good afternoon!

After installing ssl via Certbot, the browser returns ERR_CONNECTION_TIMED_OUT.
Initially, I copied the configs from the Laravel documentation, as there is a project on it.

Now they look like this:

server {
    server_name new.example.com;
    root /var/www/example.com/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

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


    listen 80;
    server_name new.example.com;
    return 404; # managed by Certbot


}


I did not find any described cases of problems with Certbot on the Internet, there may be some kind of conflict with the original file, please help...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vlog, 2021-12-02
@vlog

It turned out that the firewall was restricting access to port 443. For some reason I thought that it would be allowed by default...
The command sudo ufw allow 'Nginx Full'helped me. Thank you all for your help!

S
SagePtr, 2021-11-28
@SagePtr

With the config you showed, the site cannot work over http, returning anything other than a 404 or a redirect. There are probably other server sections in the config that have a higher priority than the ones you showed.
Full config, received by the nginx -T command, to the studio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question