Question

While trying to renew certbot certificate, got an error. (Nginx, Certbot, Node.js)

This is the error:

Performing the following challenges:
http-01 challenge for nonstopgreen.com
nginx: [warn] conflicting server name "nonstopgreen.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.nonstopgreen.com" on 0.0.0.0:80, ignored
nginx: [error] invalid PID number "" in "/run/nginx.pid"
Cleaning up challenges
nginx: [warn] conflicting server name "nonstopgreen.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.nonstopgreen.com" on 0.0.0.0:80, ignored
nginx: [error] invalid PID number "" in "/run/nginx.pid"
Encountered exception during recovery:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/certbot/auth_handler.py", line 75, in handle_authorizations
    resp = self._solve_challenges(aauthzrs)
  File "/usr/lib/python3/dist-packages/certbot/auth_handler.py", line 139, in _solve_challenges
    resp = self.auth.perform(all_achalls)
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 1071, in perform
    self.restart()
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 881, in restart
    nginx_restart(self.conf('ctl'), self.nginx_conf)
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 1141, in nginx_restart
    "nginx restart failed:\n%s\n%s" % (out.read(), err.read()))
certbot.errors.MisconfigurationError: nginx restart failed:
b''
b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/certbot/error_handler.py", line 108, in _call_registered
    self.funcs[-1]()
  File "/usr/lib/python3/dist-packages/certbot/auth_handler.py", line 323, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 1090, in cleanup
    self.restart()
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 881, in restart
    nginx_restart(self.conf('ctl'), self.nginx_conf)
  File "/usr/lib/python3/dist-packages/certbot_nginx/configurator.py", line 1141, in nginx_restart
    "nginx restart failed:\n%s\n%s" % (out.read(), err.read()))
certbot.errors.MisconfigurationError: nginx restart failed:
b''
b''
nginx restart failed:
b''
b''

I suspect the error is about Nginx configuration, but I don’t know where exactly.

Those are my domain records:

A: www.nonstopgreen.com directs to 178.62.200.182 A: nonstopgreen.com directs to 178.62.200.182


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.

Accepted Answer

I solved it, I needed to add the nginx pid number:

ps -ef | grep nginx and then write the pid to the file located in /run/nginx.pid

Then I run the command again and it worked

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.