Difficulty installing SSL for shiny app

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: www.dynamicfit.app

I ran this command: sudo certbot

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?


1: dynamicfit.app
2: www.dynamicfit.app


Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter ‘c’ to cancel): 2
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn’t close to expiry.
(ref: /etc/letsencrypt/renewal/www.dynamicfit.app.conf)

What would you like to do?


1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)


Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel): 1
Keeping the existing certificate
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/dynamicfit.app
nginx: [error] invalid PID number “” in “/run/nginx.pid”
Rolling back to previous server configuration…
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/client.py”, line 526, in deploy_certificate
self.installer.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/client.py”, line 626, in _rollback_and_restart
self.installer.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’’

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

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

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know): No

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): 0.31.0-1+ubuntu18.04.1+certbot+1


I have a shiny app that I added an SSL to. HTTP was successfully redirecting to HTTPS, and the website loaded correctly. However, I couldn’t get both www.dynamicfit.app and dynamicfit.app to work at the same time, and I couldn’t get a redirect to work. So, I tried activating a wildcard SSL for the domain, and that’s where everything went wrong.

1 Like

Your Nginx is having some issues.
Try to run Nginx first before running certbot (it might be the issue, since invalid PID…)

Also, you are only getting certificate for one hostname, but in reality you should get certificate with both www and root.
So can you try to enter 1 and 2 in the prompt?

2 Likes

Hi!

Thanks so much for responding. I actually did a sudo reboot and that fixed this problem. I abandoned the wildcard because I couldn’t figure out how to write the directives for the shiny server.

My problem is that when I run sudo certbot for dynamicfit.app, it works perfectly in the browser but then www.dynamicfit.app directs to not secure warning page. If I run sudo certbot for www.dynamicfit.app, the opposite happens (dynamicfit.app directs to the not secure warning page).

I tried entering 12 after Which names would you like to activate HTTPS for? and I got ** Error - Invalid selection **.

Any idea how I can get a certificate for both? Even our IT guy is stumped.

1 Like

To be honest, that scared me a bit. (Considering I’m a business major student😂)

It probably should be 1 and 2 (like 1 2 or something similar)
But to save time, run the below command:
sudo certbot --nginx -d www.dynamicfit.app -d dynamicfit.app

(Specifing two -d means two hostname in one certificate)

1 Like

So, it turns out that you are now qualified to work in IT and you saved my freaking life. From one student to another, THANK YOU!!! That completely solved it.

2 Likes

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