question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let's Encrypt certbot instructions causes an NGiNX error

See original GitHub issue

Details

Description

When using the instructions provided in nginxconfig.io the resulting website configuration causes NGiNX to error out.

Steps to reproduce

Setup a reverse proxy frontend website, set it to create a new certificate and run the instructions listed.

Screenshots

https://imgur.com/a/zQXXnWF

Expected behavior

Certbot should obtain the cert just fine

Error Message

nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/conf.d/nextcloud.domain.com.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

OS Version

Ubuntu 20.04 (all updates installed)

NGiNX Version

1.18 (NGiNX repo)

Website configuration

server {
    listen                  443;# ssl http2;
    listen                  [::]:443;# ssl http2;
    server_name             nextcloud.domain.com;
    root                    /var/www/nextcloud.domain.com;

    # SSL
    #;#ssl_certificate         /etc/letsencrypt/live/nextcloud.domain.com/fullchain.pem;
    #;#ssl_certificate_key     /etc/letsencrypt/live/nextcloud.domain.com/privkey.pem;
    #;#ssl_trusted_certificate /etc/letsencrypt/live/nextcloud.domain.com/chain.pem;

    # security
    include                 nginxconfig.io/security.conf;

    # logging
    access_log              /var/log/nginx/nextcloud.domain.com.access.log;
    error_log               /var/log/nginx/nextcloud.domain.com.error.log warn;

    # index.php fallback
    location ~ ^/api/ {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # reverse proxy
    location / {
        proxy_pass http://192.168.7.204;
        include    nginxconfig.io/proxy.conf;
    }

}

# HTTP redirect
server {
    listen      80;
    listen      [::]:80;
    server_name nextcloud.domain.com;
    include     nginxconfig.io/letsencrypt.conf;

    location / {
        return 301 https://nextcloud.domain.com$request_uri;
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
c0fecommented, Feb 2, 2021

very odd, i will try again tomorrow

0reactions
MattIPv4commented, Mar 24, 2021

👋 Hey folks, so I’ve created a PR to try and get around this issue with a couple of tweaks:

  1. Introducing a space between the ; and # in the listen rules, just incase nginx is parsing that badly
  2. Set ssl off; explicitly in all server blocks during the certbot setup – this rule is deprecated but still supported

If someone who can reproduce the issue described here could test out the build preview in #240 and report back, that’d be ace!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Certbot Errors & Solutions - Webdock.io
Let's Encrypt Certbot sometimes kicks up a fuss. In this article we document the most commonly encountered errors and how to solve them....
Read more >
Problem with certbot and nginx - Help
Hi, I need help setting renewing the certificate for my domain. I'm not that experienced with it but I am trying to use...
Read more >
Error in Nginx Proxy Manager Let's Encrypt - Help
I am trying to get an ssl certificate in nginx proxy manager but unable to the follwoing is the error. Error: Command failed:...
Read more >
Nginx getting internal error when asking for new ssl cert - Help
It produced this output: internal error. My web server is (include version): Synology using Docker - nginx. The operating system my web ...
Read more >
Certbot: nginx error - Help - Let's Encrypt Community Support
It produced this output: ... Thanks! The problem appears to be caused by duplicate virtual hosts. Both /etc/nginx/sites-enabled/default and /etc/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found