Using certbot-auto for nginx

I have nginx running. Now I want 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 points to the IP of my server. This is his DNS name. What am I doing wrong? I already did this for Apache, and it worked fine. My nginx works (and I cannot restart it manually after certbot-auto , but this was not necessary when I used certbot-auto --apache

+6
source share
2 answers

In my case, I had to add the line "server_name" because it was not in my nginx configuration, so it gave me the error message "Could not find the domain corresponding to myHost.Ru domain" when I ran:

 certbot --nginx 

Make sure this is in your configuration:

 server { server_name my.domain.com; .... } 
+7
source

You are probably missing server block files (virtual hosts) in a site-enabled folder. Check if your configuration files exist in /etc/nginx/sites-available and /etc/nginx/sites-enabled . If they are not present in the site support folder, create symbolic links for them:

 $ sudo ln -s /etc/nginx/sites-available/my.domain.com /etc/nginx/sites-enabled/ 

Add your site, check for configuration errors and restart nginx:

 $ sudo certbot --nginx -d my.domain.com $ sudo nginx -t $ sudo service nginx restart 
+1
source

Source: https://habr.com/ru/post/1011502/


All Articles