cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2, Nginx with Let's Encrypt!

Magento 2, Nginx with Let's Encrypt!

Please help me understand how to install the certificate. I have read many times How To Secure Nginx with Let's Encrypt on Ubuntu 16.04 But have problems on step 2.

My command:

sudo letsencrypt certonly -a webroot --webroot-path=/var/www/domain.ru/html -d domain.ru -d www.domain.ru

But I have errors:

sudo letsencrypt certonly -a webroot --webroot-path=/var/www/domain.ru/html -d domain.ru -d www.domain.ru
Failed authorization procedure. www.domain.ru (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Could not connect to www.domain.ru, domain.ru (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Could not connect to domain.ru

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: www.domain.ru
   Type:   connection
   Detail: Could not connect to www.domain.ru

   Domain: domain.ru
   Type:   connection
   Detail: Could not connect to domain.ru

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

My works config for http:

upstream fastcgi_backend {
    server unix:/var/run/php/php7.0-fpm.sock;
}

server {
    listen 80;
    server_name www.domain.ru www.domain.com domain.com;
    return 301 $scheme://domain.ru$request_uri;
}

server {
    listen 80 default_server;
    server_name domain.ru;

    set $MAGE_ROOT /var/www/domain.ru/html;
    set $MAGE_MODE default;

    location = /robots.txt {
        alias /var/www/domain.ru/html/robots.txt;
    }

    location = /sitemap.xml {
        alias /var/www/domain.ru/html/sitemap.xml;
    }

    include /var/www/domain.ru/html/nginx.conf.sample;
}

I try add block:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name domain.ru;

    location ~ /.well-known {
        allow all;
    }
}

Please share with us experiences.