I've been setting up an Nginx server to be able to access Ombi remotely (and securely) on a Raspberry Pi via my own domain. The domain's A Name has been modified - and resolves to - to my home ISP IP address. I can access the Nginx server and Ombi no problem over HTTP. Port 80 is open on my router and forwarding to the Pi IP address. Port 443 is open on the router and forwarding to the Pi IP address.
I previously installed a Let's Encrypt certificate using:
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: mydomain.co.uk
Type: unauthorized
Detail: xx.xx.xx.xx: Invalid response from
http://mydomain.co.uk/.well-known/acme-challenge/jkWODJ1CjEm03BVGkNXWZE3LifnhIbMx2brzk49oIsY:
"<!DOCTYPE html><html lang=\"en\"><head><link rel=\"preconnect\"
href=\"https://fonts.gstatic.com\" crossorigin=\"\">\n <script
type='t"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
My Nginx config for the domain looks like this (file name is mydomain.co.uk.conf):
The reason for the failure with webroot is because the -w value must match the root value for that server. So, should be this folder:
Your combination of the http and https can easily lead to trouble. I recommend creating two server blocks. One for http and one for https. Your http server block will be nothing more than a redirect to https with a location block so it handles the acme challenge. Something like this:
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/www.mydomain.co.uk/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/www.mydomain.co.uk/privkey.pem
Your certificate will expire on 2022-09-30. To obtain a new or
tweaked version of this certificate in the future, simply run
certbot again. To non-interactively renew *all* of your
certificates, run "certbot renew"
Which I'm assuming is good news.
I replaced the contents of the mydomin.co.uk.conf file with:
And that gets me the http version of my server on my domain.
However, I'm at a loss as to how to implement the https server. Does that go into the same my domain.co.uk.conf file or in a separate conf file? (You can tell I'm relatively new to this).
Normally the semi-colon is left off. I'm surprised certbot did not give a syntax error.
Absolutely!
That should not be. The return 301 should redirect to your https server which you should be able to setup now you have your cert. You need to reload nginx after making changes and if changing ports (adding/deleting server blocks for example) you should restart.
You can put the second server block (for https) in the same conf with your http server block. There are many ways to organize them but (so far) yours looks simple enough to have both in same config file.
I don't have a link to a "how to" on general nginx config off-hand.
thanks for this. I definitely restarted nginx after changing the conf and requesting the certificate. However, it's definitely not working on http and only works on http (notifying me that it's not secure).
Interestingly, when I tried the certbot command without the semi-colon, it failed. It works with it though.
I'm wary of messing with the conf file by trying to add the https server block, but I realise this isn't secure. I'll go read up on nginx server blocks.
Can you share your domain name? It is hard to give specific advice without looking. Especially for someone just beginning. Any more details you can provide from the origin request form would be helpful (I removed questions you already answered).
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. crt.sh | 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:
My web server is (include version):
The operating system my web server runs on is (include version):
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
Oh. If Plesk (or really any panel) is managing your config then you should work through the panel. Trying to update your config manually outside of Plesk can make a mess.
Yeah. I manage a lot of websites via Plesk - but I’m not hosting the site/content with my reseller account (it’s being hosted on my Pi). Can you still issue the certificate via the Plesk panel?
Also - what should I do with th wold certificate stored on the Pi?
I mentioned at the top that the DNS A name record is resolved to my home ISP IP address and nginx is hosted manually on my Pi at home. So I’m only using Plesk to manage the records. It’s not hosted on my reseller.
That's maybe not as clear as you think The DNS records only I presume?
Anyway, can you show the output of this command? Please use 3 backticks before and after the output as it will be long. Will be much easier to read. I'm not sure where the backtick is on UK keyboard. But, like this:
```
output of sudo nginx -T
```
Thanks
So, this is the only server block you have specifically for that domain name. Is that what you want it to do? That is, proxy to something at port 5000? Because that is not what you showed in your first post.
Yeah. This is weird. This isn't what's in my zoomworks.co.uk.conf file - however, it is what I want to happen (securely forward to a service on port 5000 internally)
which is clearly the one I need to be editing. Essentially what I need is for it to be https and to proxy pass forward to port 5000 on the internal server.