Host not found in “None” of the “listen” directive

My domain is:

I ran this command:

sudo certbot --nginx -d -d

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): **1**
Keeping the existing certificate
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/gardmikael
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/gardmikael
nginx: [emerg] invalid port in "[::]:None" of the "listen" directive in /etc/nginx/sites-enabled/gardmikael:23
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 2021-05-10. 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):


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

Ubuntu 18.04.5 LTS

My hosting provider, if applicable, is:


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


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


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

certbot 0.39.0
nginx -T
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
user www-data;
worker_processes auto;
pid /run/;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	# multi_accept on;

http {

	# Basic Settings

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	 server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	# SSL Settings

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	# Logging Settings

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	# Gzip Settings

	gzip on;

	# gzip_vary on;
	# gzip_proxied any;
	# gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

	# Virtual Host Configs

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

#mail {
#	# See sample authentication script at:
#	#
#	# auth_http localhost/auth.php;
#	# pop3_capabilities "TOP" "USER";
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
#	server {
#		listen     localhost:110;
#		protocol   pop3;
#		proxy      on;
#	}
#	server {
#		listen     localhost:143;
#		protocol   imap;
#		proxy      on;
#	}

# configuration file /etc/nginx/modules-enabled/50-mod-http-geoip.conf:
load_module modules/;

# configuration file /etc/nginx/modules-enabled/50-mod-http-image-filter.conf:
load_module modules/;

# configuration file /etc/nginx/modules-enabled/50-mod-http-xslt-filter.conf:
load_module modules/;

# configuration file /etc/nginx/modules-enabled/50-mod-mail.conf:
load_module modules/;

# configuration file /etc/nginx/modules-enabled/50-mod-stream.conf:
load_module modules/;

# configuration file /etc/nginx/mime.types:

types {
    text/html                             html htm shtml;
    text/css                              css;
    text/xml                              xml;
    image/gif                             gif;
    image/jpeg                            jpeg jpg;
    application/javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;

    text/mathml                           mml;
    text/plain                            txt;
    text/      jad;
    text/vnd.wap.wml                      wml;
    text/x-component                      htc;

    image/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;

    application/font-woff                 woff;
    application/java-archive              jar war ear;
    application/json                      json;
    application/mac-binhex40              hqx;
    application/msword                    doc;
    application/pdf                       pdf;
    application/postscript                ps eps ai;
    application/rtf                       rtf;
    application/         m3u8;
    application/              xls;
    application/         eot;
    application/         ppt;
    application/vnd.wap.wmlc              wmlc;
    application/  kml;
    application/      kmz;
    application/x-7z-compressed           7z;
    application/x-cocoa                   cco;
    application/x-java-archive-diff       jardiff;
    application/x-java-jnlp-file          jnlp;
    application/x-makeself                run;
    application/x-perl                    pl pm;
    application/x-pilot                   prc pdb;
    application/x-rar-compressed          rar;
    application/x-redhat-package-manager  rpm;
    application/x-sea                     sea;
    application/x-shockwave-flash         swf;
    application/x-stuffit                 sit;
    application/x-tcl                     tcl tk;
    application/x-x509-ca-cert            der pem crt;
    application/x-xpinstall               xpi;
    application/xhtml+xml                 xhtml;
    application/xspf+xml                  xspf;
    application/zip                       zip;

    application/octet-stream              bin exe dll;
    application/octet-stream              deb;
    application/octet-stream              dmg;
    application/octet-stream              iso img;
    application/octet-stream              msi msp msm;

    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;

    audio/midi                            mid midi kar;
    audio/mpeg                            mp3;
    audio/ogg                             ogg;
    audio/x-m4a                           m4a;
    audio/x-realaudio                     ra;

    video/3gpp                            3gpp 3gp;
    video/mp2t                            ts;
    video/mp4                             mp4;
    video/mpeg                            mpeg mpg;
    video/quicktime                       mov;
    video/webm                            webm;
    video/x-flv                           flv;
    video/x-m4v                           m4v;
    video/x-mng                           mng;
    video/x-ms-asf                        asx asf;
    video/x-ms-wmv                        wmv;
    video/x-msvideo                       avi;

# configuration file /etc/nginx/sites-enabled/default:
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.

# Default server configuration
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	# Note: You should disable gzip for SSL traffic.
	# See:
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See:
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	# include snippets/snakeoil.conf;

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.php index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;

	# pass PHP scripts to FastCGI server
	#location ~ \.php$ {
	#	include snippets/fastcgi-php.conf;
	#	# With php-fpm (or other unix sockets):
	#	fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
	#	# With php-cgi (or other tcp sockets):
	#	fastcgi_pass;

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#location ~ /\.ht {
	#	deny all;

# Virtual Host configuration for
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#server {
#	listen 80;
#	listen [::]:80;
#	server_name;
#	root /var/www/;
#	index index.html;
#	location / {
#		try_files $uri $uri/ =404;
#	}

# configuration file /etc/nginx/sites-enabled/gardmikael:
server {
    listen 80;
    listen [::]:80;

    root /var/www/gardmikael/public;
    index index.php index.html index.htm;


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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;

    location ~ /\.ht {
        deny all;

# configuration file /etc/nginx/snippets/fastcgi-php.conf:
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

# Bypass the fact that try_files resets $fastcgi_path_info
# see:
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php;
include fastcgi.conf;

# configuration file /etc/nginx/fastcgi.conf:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

Hi @gardmikael

I don't know if this is a problem.

But you use gardmikael.

Try, so Certbot has a matching domain name in the config file name.


Sadly, that makes no difference :frowning_face: . But thanks for replying!

1 Like

It's probably due to the contents of that configuration file. Could you share it with us?

1 Like

You could see it above in the output of the nginx -T, but I'll list it here as well:


server {
listen 80;
listen [::]:80;

root /var/www/gardmikael/public;
index index.php index.html index.htm;


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

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;

location ~ /\.ht {
    deny all;


Do note that I have made some changes since the first post. But mainly just that switched to php8.0 and php8.0-fpm


Ah, missed the nginx -T due to the fact it was folded.

Doesn't look that weird at all.

I was thinking: you're running certbot 0.39.0, probably the most recent version available in your Ubuntu repository, correct? Although it seems I can't seem to find 0.39.0 specifically Ubuntu – Details of package certbot in bionic-updates

However, this might have been a bug which might be fixed in a more recent version of certbot. It might (or not..) be a good idea to install the most recent version of certbot with the instructions on Certbot - Ubuntubionic Nginx, which are with aid of "snap" nowadays.


Someone had the same problem.

And the answer:

After many hours of debugging and research, I found out that after using cerbot , you need to remove the line listen [::]: 80; . Still don’t know why exactly…

May be you have a [..] - ipv6 listen, but you don't have a public ipv6. May be you don't have an internal ipv6.

1 Like

Google also doesn't have many results except one other person on this Community with the same problem Certbot cant Deploying Certificate

Might be a bug in the certbot nginx plugin. However, before we know that and we could file an issue @ Github, it needs to be reproducable with the most recent version of certbot.

1 Like

Please show:
ls -l /etc/nginx/sites-enabled/

1 Like
ls -l /etc/nginx/sites-enabled/

total 0
lrwxrwxrwx 1 root root 34 Oct 13 2019 default -> /etc/nginx/sites-available/default
lrwxrwxrwx 1 root root 45 Feb 10 20:39 -> /etc/nginx/sites-available/

1 Like

Tried removing listen [::]: 80;

No difference

1 Like

I tried uninstalling certbot and installing it with snapd.
certbot --version still prints certbot 0.39.0


Then you're still runnng your old version probably. Or some whole different kind of version, as - like I said - I didn't find any 0.39.0 currently in the Ubuntu repositories.

What's the output of whereis certbot and ls -l /usr/bin/certbot?


Oh, yeah. Thats interesting:

whereis certbot

certbot: /usr/bin/certbot /usr/local/bin/certbot /snap/bin/certbot

ls -l /usr/bin/certbot

-rwxr-xr-x 1 root root 385 Dec 18 21:47 /usr/bin/certbot


I don't understand how this:
include /etc/nginx/sites-enabled/*;
includes this:
configuration file /etc/nginx/sites-enabled/gardmikael
And confirmed by this:

But you showed this in that folder:

How does:

Maybe a hidden file?
ls -la /etc/nginx/sites-enabled/


Weird. I'm not familiair with /usr/bin/certbot NOT being a symbolic link to anything else. (In the case of the "snap" method of installing, it should be a symbolic link to /snap/bin/certbot.

Also, I'm not that familiair with Ubuntu. Can you check to which package /usr/bin/certbot belongs? Also, /usr/local/bin/certbot is not something I recognise: perhaps it was installed with "pip" or something?


That was my idea - to rename that file.

1 Like

I see how that is confusing. Before i posted the first post it was /etc/nginx/sites-available/gardmikael and when someone suggested changing the name I did. In later posts I have just copy-pasted after making changes.


You seem to have dueling certbots!

If you specifically call the one from snap, do you have this same problem?
/snap/bin/certbot --nginx -d -d


Solution! Thank you

Thank you to everyone who bother to help! I really appreciate it!! :smiley: