Nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/cockpit:1

My domain is: muxxlenetzwerk.at

I ran this command: sudo certbot install --cert-name muxxlenetzwerk.at

It produced this output: nginx restart failed:
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/cockpit:1

My web server is (include version): nginx version: nginx/1.18.0 (Ubuntu)

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

My hosting provider, if applicable, is: OWN SERVER

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): yes

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

I produced this error but I don't have any ssl ceritifcate for it, I want to make one. Can someone help?

Please show this file:

and the output of:
sudo certbot certificates

cockpit file

    listen 81;
    listen 443;
    server_name _;
    root /var/www/cockpit;
    index index.php;
    location / {
      try_files $uri $uri/ /index.php$is_args$args;
    }

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

    # Deny direct access to .sqlite
    location ~ .sqlite$ {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param COCKPIT_URL_REWRITE On;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }
}

certbot

Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: muxxlenetzwerk.at
    Serial Number: 4f81b961a62ce5669125c5b8c20a9e29994
    Key Type: RSA
    Domains: muxxlenetzwerk.at
    Expiry Date: 2021-09-20 06:57:56+00:00 (VALID: 89 days)
    Certificate Path: /etc/letsencrypt/live/muxxlenetzwerk.at/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/muxxlenetzwerk.at/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Try get rid of this line, before you run certbot install.

3 Likes

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