using certbot-auto for nginx

lets-encrypt, nginx, ssl

Solution

In my case, I had to add the "server_name" line because it wasn't in my nginx config so it was giving me the error message "Cannot find a VirtualHost matching domain my.domain.com" when I ran:

certbot --nginx

Make sure this is in your config:

server {
    server_name my.domain.com;
    ....
}

Problem

I have an nginx running. Now I want my nginx to use SSL: ``` certbot-auto --nginx -d my.domain.com -n --agree-tos --email admin@mail.com ``` OUTPUT: ``` Performing the following challenges: tls-sni-01 challenge for my.domain.com Cleaning up challenges Cannot find a VirtualHost matching domain my.domain.com. ``` my.domain.com is pointing to the IP of my server. It's its dns name. What am I doing wrong? I did this already for apache and it was working fine. My nginx is running (and I'm not able to restart it manually after the `certbot-auto` but this wasn't necessary when I used `certbot-auto --apache`

Original source