Nginx: [emerg] host not found in "None" of the "listen" directive in /etc/nginx/conf.d/

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g., so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command: certbot --nginx

It produced this output:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 21
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/
nginx: [emerg] host not found in "None" of the "listen" directive in /etc/nginx/conf.d/
Rolling back to previous server configuration...
nginx restart failed:

 - We were unable to install your certificate, however, we
   successfully restored your server to its prior configuration.
 - Congratulations! Your certificate and chain have been saved at:
   Your key file has been saved at:
   Your cert will expire on 2019-09-17. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"

My web server is (include version): Nginx 1.16.0

The operating system my web server runs on is (include version): Ubuntu 16.04

My hosting provider, if applicable, is: Scaleway

I can login to a root shell on my machine (yes or no, or I don’t know): Yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): certbot 0.34.1

Edit: Oh oops forgot nginx config

server {
    listen 80;


    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

That file is 21 lines long, right?

It sounds like there’s some sort of subtle syntactic error in the Nginx configuration – maybe a missing “;” or “}” somewhere.

Can you post the output of “sudo nginx -T” and /var/log/letsencrypt/letsencrypt.log?

Hi @Wingysam

you want to create a certificate with this domain name:

But your nginx doesn't have the -df - part.

So there is no vHost.

1 Like

I fixed the nginx config, and it’s working without HTTPS. I am running a webhook which is not for browsers so I don’t need to worry about a MitM from someone’s ISP.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.