documentation
documentation copied to clipboard
certbot instructions fail with ssl_certificate error on clean Ubuntu 20.04 LTS
I followed the installation instructions pretty much to the letter, and the only hitch was the step "Acquiring a SSL certificate" which failed with the following error (actual host name was used, not example.com):
certbot --nginx -d example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/mastodon:25
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/mastodon:25\nnginx: configuration file /etc/nginx/nginx.conf test failed\n')
I was able to pass this step by following these instructions:
This seems like a more complicated solution than is necessary. I just recently migrated to a new Ubuntu 20.04 server and similarly had issues with the instructions. A simpler way to resolve it is to simply run certbot in
--standalonemode before (re)loading nginx:
- ~install
python3-certbot-nginxinstead ofpython-certbot-nginx~ (docs already updated)- Stop nginx (
systemctl stop nginx) before running certbot (otherwise--standalonecan't access ports 80/443)- uncomment the certificate paths in the nginx.conf file and replace 'example.com' with the real domain
- run certbot with
certonly --standalone(certbot certonly --standalone -d example.com)- Restart nginx:
systemctl start nginxOriginally posted by @hughrun in https://github.com/mastodon/documentation/issues/826#issuecomment-827558844