Ubuntu 18.04 NGINX and Certbot SSL issues

Hi all, so I just set up my first droplet on DigitalOcean and completed the installation of iRedMail and it’s working fine however my attempt to install and enable certbot is giving me no results.

I’ve checked several guides including this one and cannot seem to identify the issue. I have certbot running on another server, here I am using Ubuntu 18.04 NOT 16.04 which may affect sites-available server blocks.

I installed certbot:

apt-get update
apt-get install software-properties-common
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
sudo apt-get install certbot python-certbot-nginx

certbot certonly --nginx --dry-run -d -d
certbot certonly --nginx -d -d
root@mail:~# certbot
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated)  (Enter 'c' to cancel):
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): 2
Renewing an existing certificate
Could not automatically find a matching server block for Set the `server_name` directive to use the Nginx installer.

 - Unable to install the certificate
 - Congratulations! Your certificate and chain have been saved at:
   Your key file has been saved at:
   Your cert will expire on 2019-06-11. 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"```

```nginx -t
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
crontab -e
    15 3 * * * /usr/bin/certbot renew --quiet
    15 3 * * 5 /usr/bin/certbot renew renew >> /var/log/le-renew.log

In /etc/nginx/sites-available I have two files:

00-default-ssl.conf (content below)

# Note: This file must be loaded before other virtual host config files,
server {
    listen 443;
    server_name _;

    root /var/www/html;
    index index.php index.html;

    include /etc/nginx/templates/misc.tmpl;
    include /etc/nginx/templates/ssl.tmpl;
    include /etc/nginx/templates/iredadmin.tmpl;
    include /etc/nginx/templates/roundcube.tmpl;
    include /etc/nginx/templates/sogo.tmpl;
    include /etc/nginx/templates/netdata.tmpl;
    include /etc/nginx/templates/php-catchall.tmpl;
    include /etc/nginx/templates/stub_status.tmpl;

```00-default.conf (content below)

Note: This file must be loaded before other virtual host config files,


server { # Listen on ipv4 listen 80;

# Listen on ipv6.
# Note: this setting listens on both ipv4 and ipv6 with Nginx release
#       shipped in some Linux/BSD distributions.
#listen [::]:80;

server_name _;

# Redirect all insecure http:// requests to https://
return 301 https://$host$request_uri;


Note there is no ‘’ or ‘’ site block.

root@mail:/etc/nginx/sites-available# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

I’m a bit lost where to look for a solution. Do I have a conflict with letsencrypt and certbot names? Have I incorrectly/incompletely setup sites-available and sites-enabled? All suggestions appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


If you’ve installed iRedMail, I do not recommend following other instructions for configuring the SSL. Any instruction for it should be iRedMail specific, because that software will control the web server and may not use an OS-default setup. It may also overwrite configurations on update. I found a guide for setting this up though, and it may be helpful: