Report this

What is the reason for this report?

SSL Certbot Certificate Expired -> Appearance of 502 Gateway Error when trying to renew

Posted on September 26, 2019

Today my site broke as the SSL Certificate expired. The certbot setup was setup to automatically renew, however that did not execute, and manually trying to renew/reinstall the certificate comes back with a 502 Gateway Error for the HTML Verification pages it works through.

Since this may be related to a NGINX Configuration error, here are my nginx files. Feel free to critique what I should change in order to optimize it.

I’ve also included some commands to certify that services are in proper working order, despite the 502 Gateway error.

Thank you for any support you can give.

sudo certbot --nginx -d xevion.dev -d www.xevion.dev

GitHub Gist

The only thing I can point out is that it’s working on HTTP and not HTTPS, which I can’t seem to find a specific reason for? I don’t remember needing to type in any special arguments to get it to work on HTTPS only. Additionally, I ran it with multiple arguments and some not at all to make sure that it had no effect and that it was using HTTP autonomously. I believe this might be the source of the problem, somehow.

nginx -t

xevion@ubuntu-s-1vcpu-1gb-lon1-01:/var/log$ sudo nginx -t
nginx: [warn] conflicting server name "xevion.dev" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.xevion.dev" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "xevion.dev" on [::]:80, ignored
nginx: [warn] conflicting server name "www.xevion.dev" on [::]:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

I’m not sure of the fix for the first couple of warns, perhaps they’re for HTTP IPv4 & IPv6, which is completely impossible with the HSTS policy in place. But business as usual, it has always been that way.

systemctl status nginx;systemctl status xeviondev

GitHub Gist

cat nginx.conf

GitHub Gist

cat /sites-available/xeviondev

GitHub Gist



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!

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.

Hello,

The Nginx config looks correct. Can you confirm if your AAAA record actually matches the IPv6 that you have assigned on your server?

Also what I could suggest is:

  • Check your Nginx error log:
tail -100 /var/log/nginx/error.log

This should give you some more information for further troubleshooting.

Let me know how it goes.

Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.